ID « Relationship « JPA Q&A





1. Setting ID for foreign key    stackoverflow.com

I have two tables:

Categories (id, name, abbr)
Project (id, name, categoriesID) 
The relationship is one to many (1 Categories to Many Projects). I use Hibernate DAOs and Mapping to store the data ...

2. Foreign Key Relationship with different names for same id    forum.hibernate.org

Hi There, I've searched the forum but can not find an answer to the relationship's I want to map. I have two tables CATEGORY and CATEGORY_GROUP. For simplicity sakes CATEGORY contains a single ID called CAT_ID and CATEGORY_GROUP contains a composite key called PARENT_CAT_ID and CHILD_CAT_ID. This represents a recursive relationship where each category can have many child categories and many ...

3. Design many-to-one relationship with two columns id    forum.hibernate.org

Hi. I just started using Hibernate and I'm impressed of its power and flexibility. I've designed schema (mappings) for almost 100% of my database, but now I stucked with one relationship. Unfortunately the database is not designed by me and I cannot change it. I have two tables Code: PICK_TABLE: - guid ...

4. Constructing entity relationships with ids vs. refs...    forum.hibernate.org

I often find myself constructing "fake" entity objects just to hold the id of the entity so that I can create an dependent entity... i.e.. I often have the id of an object but the object isn't in the session and there's no reason to load it. e.g. Supposed I already know the customerId but don't have the Customer entity handy... ...

5. One to Many self-referential relationship and @Id    forum.hibernate.org

I am using hibernate and jpa to store an object. I have a class that has a OneToMany relationship with itself. Basically the Main Object contains objects of the same type in a Map. An example class of what I mean (if I am not being clear): Code: @Entity public class ExampleObject { ...

6. How to use many-to-many relationship ID as foreign key    forum.hibernate.org

I have table A and table B that are mapped to classes A and B respectively (you can assume the most simplistic mappings for now) that have identifiers A_ID and B_ID. They have a many-many relationship that is given an ID, AB_ID in an AB_Relationship table.. There is a third class C that is mapped to class C with identifier C_ID. ...

7. OneToOne relationship - Provided id of the wrong type    forum.hibernate.org

@Entity @Table(name = "A") public class A implements java.io.Serializable { private AId id; // it contains 'fieldOne', 'fieldTwo' and 'x' private int foo; private B b; // 1-to-1 relationship with B // .. code .. @OneToOne(mappedBy="a", targetEntity=B.class) ...