entity

ORM - Does the Database Schema Drive the Entity Composition or Vice-Versa?

We've had quite a bit of discussion among our development group concerning whether the composition of entities should drive the database design, or should the database design drive the composition of the entities. For those who have dealt with this, what has been your philosophy? Of course, not every entity maps 1:1 to a database table....

How to do recursive load with Entity framework?

Hi, I have a tree structure in the DB with TreeNodes table. the table has nodeId, parentId and parameterId. in the EF, The structure is like TreeNode.Children where each child is a TreeNode... I also have a Tree table with contain id,name and rootNodeId. At the end of the day I would like to load the tree into a TreeView but I can't fi...

nhibernate: query criteria for an entity and possibly a subclass in the same query

This is the setup for my 2 entities: public class Person { public Guid Id {get;set;} public string Name {get;set;} } public class Immortal : Person { public string DarkName {get;set;} } Here's what their mapping looks like: <class name="Person"> <id name="Id"> <generator class="guid.comb"/> </id> <property name="Name...

How to make second test passing in these C# Xml unit tests? What do I miss in initialization of XmlReaderSettings?

Issue description: I need to fix an issue with resolving of standard HTML entitities. I've implemented HtmlEntityReader - implementation of XmlReader which has a code to resolve entities Public API of our system provides a methods with usage of XmlReader, so user can pass XmlReader created using one of the XmlReader.Create methods ...

What is the HTML entity for up and down triangles?

I've found the outlined versions, but I want the solid ones. Does anyone know these entities? Thanks ...

Hibernate HQL with interfaces

According to this section of the Hibernate documentation I should be able to query any java class in HQL http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-polymorphism Unfortunately when I run this query... "from Transaction trans where trans.envelopeId=:envelopeId" I get the message "Transaction is n...

ADO.NET Entity Framework Hierarchy type Inheritance Error 3032 Workaround??

I would like to implement a Hierarchy Type Inheritance ... i.e. Cars to BMWs ... Cars would have CarTypeID that is associated with CarTypes. I would like CarTypeID to be the discriminator column. Unfortunately, I cannot do this in ADO.NET Entity Framework. If I would like to keep the association, how am I able to achieve this? Has an...

How do I embed a String Array into an Entity (JPA)

I wanna design an Entity Class which has a String[] property. This String Array always has two values and I dont want Hibernate (or rather JPA) create an extra table for this but embed this two String values directly into the table. Is this possible and if so how? ...

Should Enterprise Java entities be dumb?

In our legacy JEE application, there are loads of value object (VO) classes which typically contain only getters and setters, maybe equals() and hashCode(). These are (typically) the entities to be saved in persistence storage. (For the record, our app has no EJBs - although that might change in the future -, and we use Hibernate for pe...

How to retrieve mapping table name for an entity in JPA in runtime?

Is it possible to determine the native table name of an entity? If Table annotation is present it's easy: entityClass.getAnnotation(Table.class).name() But is it possible to get the table name, if no Table annotation is present? Hibernate provides the information via Configuration https://www.hibernate.org/hib_docs/v3/api/org/hibern...

LINQ to Entities does not recognize the method ElementAt(i);

Hi, i'm using the method elementat for get a specific element of a query's result. var mds = db.TDP_MissioniDestinazioni.Where(p => p.MissioneID == missioneRow.MissioneID); destinazioneRow = mds.ElementAt(i); LINQ to Entities does not recognize the method 'TimeEntModel.TDP_MissioniDestinazioni ElementAt[TDP_MissioniDestinazioni](S...

How to generate entity framework model from client side?

Can I generate entity framework model by clicking button in browser in client-side and save it back to web server PC? ...

linq include with condition

i have function public Menu Details(int? id) { return _dataContext.Menu.Include("ChildMenu").FirstOrDefault(m => m.MenuId == id); } now i need to add condition to child list ChildMenu something like fieldname=id. how can i do it? ...

Get changes to entity after update in database

I do this to save new invoince in my Invoices database table: // insert invoice into EDM edmx.AddToInvoices(newinvoice); // save EDM changes to datastore edmx.SaveChanges(); I have a trigger on one of the columns that gets computed dynamically by the database. What is the...

Entity Framework : Entity from a View

in my database a have an invoice table and a payment table. i have a transactions view that shows payments and invoices. i created an entity from that transaction view. in my application i want to be able to add a payment from the transaction screen (which is a datagrid of transaction entities) and that the list of transactions be updat...

Data bind IEnumerable<of anonymous type> with entity framework

I'm binding this Entity framework query to a gridview and is ultra slow. The delay is on databinding. Any solution? Using ctx As New DBEntities() Dim PROC= (From p In context.Table.Include("RELATION") _ Where p.KEY= 1 _ Select p).First() Dim q1 = From r In PROC.relation _ Select New With ...

Need help understanding Generics, How To Abstract Types Question.

I could use some really good links that explain Generics and how to use them. But I also have a very specific question, relater to working on a current project. Given this class constructor: public class SecuredDomainViewModel<TDomainContext, TEntity> : DomainViewModel<TDomainContext, TEntity> where TDomainContext : Doma...

How to detect ndash entity embedded in a textarea using Javascript?

I have a textarea within an HTML page into which my users paste content. There is often an "" (&ndash;)(\x2013) embedded in that content. I need to detect and replace it and store it in a database as &ndash;. My code document.getElementById("input").value.replace("-", "&ndash;"); only detects the "-" (minus sign)(\x2D). What would be...

The same objects in JPA

Hello, I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A { @Id @GeneratedValue(strategy = GenerationType.AUTO) Long id; //equals, hashCode autogenerated by nb. } And: @Entity class B { @Id @GeneratedValue(strategy = GenerationType.AUTO)...

org.xml.sax.SAXParseException: The entity "ndash" was referenced, but not declared.

I'm parsing the the following... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE tox:message SYSTEM "http://tox.sf.net/tox/dtd/tox.dtd"&gt; <tox:message xmlns:tox="http://tox.sourceforge.net/"&gt; <tox:model owner="scott" package="queue" function="appendFact"> <tox:parameter value=" By John Smith &ndash; Thu Feb 25, 4:54 pm ET&lt;br...