side « Relationship « JPA Q&A





1. JPA: which side should be the owning side in a m:n relationship?    stackoverflow.com

Say for example I had to entities "Article" and "Tag" (like in a typical blog). Each article can have many tags, and each tag can be used by many articles, so ...

2. Retrieving the ID of many-side objects in a many-to-one relationship in Hibernate    stackoverflow.com

Let's say I have two classes, Parent and Child. These two are related via a uni-directional relationship.

<bag name="children" cascade="all">
    <key column="parent_id" />
    <one-to-many class="Child" ...

3. one-to-many relationship and passing the same n-side    forum.hibernate.org

Hi, In have a Person object and it contains a set of PersonItems objects. I have implemented the one-to-many between Person<->PersonItems. I create two different objects of type Person, but I pass the same PersonItems set to both. How can I tell Hibernate to insert PersonItem sets in the db for both Person objects? It seems that I only get the ...

4. many-to-many only populating one side of relationship    forum.hibernate.org

Hi folks, I have been driving myself crazy trying to get a many-to-many mapping to work properly and I am hoping that it is something simple! I have three tables: 1) accomodation 2) accomodation_electronic 3) contact_electronic accomodation_electronic is the table that joins accomodation and contact_electronic - it simply holds foreign keys to both tables. In the code snippet below I load ...

5. one-to-many relationship supporting traversal from one side    forum.hibernate.org

Newbie Joined: Fri Oct 22, 2004 10:55 am Posts: 17 [b]Hibernate version: 2.1.6[/b] We have one-to-many relationship between two tables. Transaction can have many Alternate_transaction_id We want to set up the relationship so that 1. Traversal from transaction to alternate_transaction_id is supported. 2. Traversal from alternate_transaction_id to transaction is NOT supported. When alternate transaction id is retrieved directly there should not ...

6. any-to-many side of an any relationship    forum.hibernate.org

Frankly speaking, I am running out ideas on how to get it work and I need your help please!!!! is there a way to describe an association between any two tables where there are no foreign constraints at all in a hibernate mapping file. Let me give you an example: We have three tables: table1, table2, table3. Table 1 and 2 ...

7. Remove one side in bi-directional many-to-many relationship    forum.hibernate.org

Hibernate version:3.2 I need to be able to remove just one side in a bi-directional many-to-many relationship between a user table and a role table. If I do session.delete( user ) followed by a flush(), I then want the user to be deleted (as well as the association table data), but not the role. # If I use cascade=none and then ...