question « Relationship « JPA Q&A





1. Hibernate O To M Relationship question.    coderanch.com

Hi, I've on scenario of 1 to M. Country -> State where a country may have many states. A country stores a set of States. So in Country.hbm.xml I've When I create a country with 2 states in Java code, it fires 1 Country Insert, 2 State inserts and 2 ...

2. JPA Entity Relationships Newbie Questions    coderanch.com

Hey guys, This is my first post so I hope I am going about this the right way. I am working on my first JPA project ever so this may seem like some very basic questions but please bear with me. My work has me putting together a database for all of the awards we have given out over the last ...

3. question related on-to-many relationship    forum.hibernate.org

Hi, I have this one-to-many relationship. My requirement is when the parent object (one) is retrieved only certain child objects(many) should be retrieved based on a criteria and not all the child objects. For example , I have a "Partner" object & it has a set of "Process" objects , but when the "Partner" object is retrieved only certain "Process" objects ...

4. Simple Question about one-to-many relationship    forum.hibernate.org

Sorry for some simple question I have a parent object which is one-to-many to chidren object. The parent keeps the reference to its children in a Set. The children object keeps the reference to its parent. Both of them have not been saved to the database. 1. Suppose it is "save-update" cascade, when saving the parent to the database, the children ...

5. a little different many-to-many relationship question    forum.hibernate.org

import java.sql.Date; import java.util.HashSet; import java.util.Set; public class Order { private String id; private Date order_date; private double final_cost; private boolean order_confirmed; private Set product_ordered = new HashSet(); public Order() { } .... Standards get and set methods .... public Set getProduct_ordered(){ return product_ordered; } public void setProduct_ordered(Set product_ordered){ this.product_ordered=product_ordered; } }

6. intersection table m:m relationship question    forum.hibernate.org

Just need some clarification here, so I don't think source is necessary. Let's say i have a parent -child relationship, that are many to many in my object model. Typically, the database will use 3 tables to resolve this many-many relationship. I have effectively used hibernate so that I can make this happen, but I am wondering if it is possible ...

7. Question regarding one-to-many relationship    forum.hibernate.org

I've a class A which has one to many relationship with class B. Each row in class B need not be unique and hence need not have a primary key, but should have A.id like below class A { private Long id; Set bs; } class B { private Long aId; private String data; } aId is the foreign key from ...

8. Simple question about many-to-many relationships    forum.hibernate.org

I've implemented a many-to-many relationship for the first time, and there are a couple of things which are unclear to me. I have two classes, Team and Competition. A Team can belong to many Competitions, a Competition can contain many Teams. So, I have successfully mapped this as a many-to-many using a bridging table, team_competition. My first problem is now how ...

9. questions on only remove relationship between many-to-many    forum.hibernate.org

hi,all! I am a newbie in hibernate. Now, I come across one problem. I want to remove the relation between two entities only. Take for example, I have two entities such as User and Group. They have a many-to-many relationship. Now I want to remove a user from the group. One solution is to load group's user colletion and remove related ...





10. One-to-many relationship question    forum.hibernate.org

Hibernate version: 3.2 Spring 2.0 Database: Sybase 12.5 We have to tables, exactly the same as Parent and Child, one-to-many relationship. My problem is, the Child table has no primary key, only foreign key (which of course can be duplicated). How will I write my hibernate XML mapping for these tables? Many thanks