entity « Association « JPA Q&A





1. Hibernate many-to-many association with the same entity    stackoverflow.com

Another Hibernate question... :P Using Hibernate's Annotations framework, I have a User entity. Each User can have a collection of friends: a Collection of other Users. However, I have not been able ...

2. Hibernate one-to-one entity association with shared PK between 3 classes    stackoverflow.com

I want a unidirectional one-to-one relationship between objects of 3 java classes: Person to Heart, and Person to Liver. I want the objects to share the same PK i.e. every person ...

3. Does Hibernate support one-to-one associations as pkeys?    stackoverflow.com

Can anyone tell me whether Hibernate supports associations as the pkey of an entity? I thought that this would be supported but I am having a lot of trouble getting any ...

4. How to manage association entities in Hibernate / BlazeDS    stackoverflow.com

I'Ive been working on Java/Hibernate/BlazeDS integrations - but am getting stuck with sending the child entities in a one-to-many relationship across BlazeDS... For starters I have a Client and ClientLinks table in ...

5. can not delete the entity using session.delete()    stackoverflow.com

I have some entity in my application,and some of them are many-to-many association,when I try to delete them I get the error:"Cannot delete or update a parent row: a foreign key ...

6. Best practise: multi 1:n association to same target entity    forum.hibernate.org

Hello, i'm a little bit confused how to model following situation: I have a entity DescriptionItems which has an attribute Locale to be independet from different languages, and the descritption itself. Now i have two furter entities: Entity A: Has a Map of description items called logicalDescritptions and a Map technicalDescriptions What is the best way to implemnt this relationship? One ...

7. Association of many collections to a single entity    forum.hibernate.org

List aasWithBeesInitialised = session.createQuery( "from A ac "+ "left join fetch a.bee b") .list(); List ceesWithAasInitialised = session.createQuery( "from Cee c " "left join fetch c.a") .list();

8. error deep-deleting entity with associations,failed update    forum.hibernate.org

Newbie Joined: Wed Aug 31, 2005 2:29 am Posts: 8 Hello, I do have a problem with deep-deleting an object and it's children. The problem seems to be, that hibernate tries to update an object i have deleted, although i did not change any properties. The object i want to delete and it's children were created in the same session and ...

9. how to delete this entity along with its associations?    forum.hibernate.org

the problem here is I defined the hbm mapping file by myself: I first generated a hbm file using middlegen,then I manually deleted the association definitions as below,for the BO here need not to be aware of the loading of these sets,I delete these definitions for the sake of simpleness of this BO.





10. managing entity associations (java and ehcache)    forum.hibernate.org

Greetings! I would like to discuss managing java bi-directional relationships with ehcache. My situation is: - legacy data model (batch updates from external source) - data is versioned (configured in mapping) - managing the relationships manually (ie no transitive persistence) My problem is: cached childs parent is null e.g. Sess1 --> session.persist(parent); Sess2 --> session.persist(child); Sess3 --> session.query( returns child ) ...

11. controll if associations are updated if an Entity is changed    forum.hibernate.org

Hello! One can statically determine if a save in one entity leads to a save in an associated entitie (or entities, for many-case) by means of the cascade-attribute in the mapping or by annotations. But is it also possible to determine the desired behaviour for the following cases? 1. For value-objects, then of course dynamically, other would make no sense. 2. ...

12. Association between two entities in two different databases    forum.hibernate.org

Hi, I have two entities : List and ListGroup. The relationship is many-to-one. The List table contains list id and list name. ListGroup table contains listgroup id and listgroup name. There is one more table called ListToListGroup which contains listid and listgroup id. However, List table exists in one database and Listgroup and ListToListGroup tables exist in another database. I would ...

14. Two associations between two entities !    forum.hibernate.org

Hi all, I have relation between two classes like this: |Class1| <>-[1]--------[*]-> |Class2| and an annotation on the Class2 end @OneToMany(cascade=ALL), but I have also one more association from Class1 to Class 2, like this: |Class1| ------------------[1]-- |Class2| So, in the Class1 instance, I have collection of Class2 instances (the first diagram), and also I have one another object of the ...

15. Move entities in one association to another association?    forum.hibernate.org

I want to move the entities in one association to another association, but failed. The following is what I did. What is wrong in my code? Thanks for your help. The case is: one Guard owns many Devices. The following is the entity definitions: Code: @Entity @org.hibernate.annotations.Entity( dynamicInsert=true, dynamicUpdate=true ) @Table(name="GUARD", uniqueConstraints={@UniqueConstraint(columnNames={"name"})}) public class Guard ...

16. Entity Association Help    forum.hibernate.org

I'm having a hard time wrapping my head around this. I have a user entity and an event entity. Currently i have a bunch of lists for users who are part of an event. I'm trying to figure out the easiest way of doing the following. I need some users to be special in that for a certain event each of ...





17. Repeated column along entity associations    forum.hibernate.org

@Entity class Parent{ OneToMany(target = MyObject.class) JoinColumn(name = "DEF_ID", nullable = false) List listObjects OneToMany(target = Child.class) JoinColumn(name = "FK", nullable = false) List listChilds } @Entity class Child{ ...

18. Multiple association relationship between two entities    forum.hibernate.org

I have two entities Item, User Code: class User { @OneToMany(mappedBy="uploadedBy", cascade=CascadeType.ALL) List uploadedITems; @ManyToMany List bookmarkedItems; } class ITem { @ManyToOne User uploadedBy; } OneToMany bidirectional relationship between User And Item through User.uploadedItems & Item.uploadedBy. A user can upload multiple Items. If ...

19. Cast Entity association collection to implementation type    forum.hibernate.org

@Entity public class Foo1 { @Id private Long id; @OneToMany(mappedBy="foo1"); Set foo2s; public void addFoo2(Foo2 foo2) { if (foo2s == null) { this.foo2s = new TreeSet(); } this.foo2s.add(foo2); } ...

20. Association between entities: Could not determine type    forum.hibernate.org

Newbie Joined: Wed Sep 09, 2009 4:51 pm Posts: 1 Hi guys, I am new to hibernate and having hard time for mapping two entities. I am building the application under Seam 2.1 + JBoss AS 5.0.0.GA I am using hibernate as JPA provider by default in Seam 2.1 project. Database is MS SQL 2005. Code: @Entity @Table(name="UserClinicalData") public class MeasurementData ...