parent 1 « Map « JPA Q&A





1. Hibernate Cross Reference many-to-many Parent/Child Mapping Of Same Class    stackoverflow.com

I'm having a major problem getting a parent/child relationship working for a hierarchy of a single class. Basically I have to represent a server tree like thus:

Server A
    ...

2. Hibernate - map object that belongs to two other objects (object with 2 parents)    stackoverflow.com

I'm having a bit of trouble mapping the following:

public class Operation {
  private Integer id;
  private String name;
  private List<Item> items = new ArrayList<Item>();
  //set/getters/hashcode/etc. omitted

  ...

3. Hibernate parent Child mapping    stackoverflow.com

Working on mapping parent-child relation mapping in Hibernate and not able to find the best possible way to do this.Here is the description of the problem. I have a class as parent ...

4. hibernate grandfather , parent ,child mapping problem    stackoverflow.com

I have a problem where I have this three grandfather parent and child and I am trying to get from parent all his children he gives me an half of is ...

5. Hibernate parent-child mapping    stackoverflow.com

I'm trying to map an order and its order items in Hibernate. An order item should not be able to reference its parent order:

public class Order {
    ...

6. hibernate : child changes but parent doesnt know    coderanch.com

Hi Guys : I have a hibernate issue which should be fairly common. class Car { Set passengers; //getters and setters. } Now, when I modify one of the passengers (call it p) , and I call session.refresh(p), the car's list of passengers does not reflect this modification. How can i make sure that an object's children will be modified in ...

7. Parent-Child Mapping with Hibernate 2.0    coderanch.com

Hi Guys, Been trying to solve the following issue for days. I hope anyone can shed some light on this. My collections (child) are always deleted when i called saveOrUpdateCopy(parent) with/without any modifications. I open up the session to load the parent and pass it back to the UI layer for some modifications (to both parent and the children.). Somehow after ...

9. Hibernate mapping : Parent ->Child(Male or Female)    coderanch.com

Hi all, I'm facing problem to create mapping based on the following scenario. Parent ---------------- Id -> long name -> varchar Child ----------------- Id -> varchar name -> varchar parent_id -> long gender -> short [1-for male, 2 for female] Now from parent entity object want to get babyChildren [set/list] and boyChildren [set/list]. Please suggest How I could achieve my goal? ...





10. Limit child collection when setMaxResult is used on parent    forum.hibernate.org

I have a parent entity with a @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER) child collection. When querying the parent using setMaxResults I get sql with the "limit" sql keyword. After that the sql generated by hibernate to fetch the children doesn't have the limit keyword. So I will get all the children of all the parents (without the limit) out of ...

11. Parent/child Relationsship    forum.hibernate.org

Hello I have two class @entity public class Ordine { private Set merceQuantita = new HashSet(); @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST,CascadeType.MERGE},mappedBy="ordine") public Set getMerceQuantita() { return merceQuantita; } public void addMerceQuantita(MerceQuantita mq){ mq.setOrdine(this); this.merceQuantita.add(mq); } ... } @Entity public class MerceQuantita { private Ordine ordine; @ManyToOne(targetEntity = Ordine.class) @JoinColumn(name="ordine",nullable=false) public Ordine getOrdine() { return ordine; } ... } When I ...

12. Problem trying to move the children of a Parent to another    forum.hibernate.org

Author Message fredbasset Post subject: Problem trying to move the children of a Parent to another Posted: Wed Jan 27, 2010 7:06 pm Newbie Joined: Wed Jan 06, 2010 9:09 pm Posts: 14 Hi All, I have a one-to-many parent->child relationship, an ARSEServerNode has a set of TravelTimeLinks. I need to move the children of one parent to be ...

13. Parent Child question    forum.hibernate.org

Hello, I have a parent-child of the same class. When I declare a persisted object to have a parent, I get a org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [class + objects' primary key here]. I don't have this issue when running this change as a unit-test. If I create the child to ...

14. Parent one-to-many / many-to-one Child    forum.hibernate.org

Note: I think I solved it. I just need confirmation. Please see second post. I have a parent/child situation I can't get working. I have Country (parent) which contains cities (children). These are my mappings: Code: ...

15. Retrieving parents with specific 'grand children'    forum.hibernate.org

Hello all, I am very new to Hibernate, so this has been stumping me for the past few days. Suppose you have a person, that has dogs, who have toys: Code: Person A Dog 1 Toy - Red Toy - Green ...

16. parent/child + one of its children as many-to-one in parent    forum.hibernate.org

Root cause: org.hibernate.PropertyValueException: not-null property references a null or transient value: components.Parent.specialChild at org.hibernate.engine.Nullability.checkNullability(Nullability.java:101) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:313) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669) at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252) at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascade(Cascade.java:161) at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:451) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at ...





17. Hibernate invasive on parent/child collection?    forum.hibernate.org

Hi, We proclaim Hibernate as a lightweight, non-invasive persistence solution (at least I do!), but it seems I'm being forced to deviate from a POJO construct I would normally use. Maybe someone could help. To illustrate I'm using a parent / child relationship with real world familiar objects. I have a Year object that contains a List of Month object(s). If ...

18. Hibernate mapping : Parent ->BoyChldrn, Parent ->BabyChldrn    forum.hibernate.org

Hi all, I'm facing problem to create mapping based on the following scenario. Parent ---------------- Id -> long name -> varchar Child ----------------- Id -> long name -> varchar parent_id -> long gender -> short [1-for male, 2 for female] Now from parent entity object want to get babyChildren [set/list] and boyChildren [set/list]. Please suggest How I could achieve my goal? ...

19. Adding Existing Children to a Parent    forum.hibernate.org

I have a class structure of Parent ---- Child ---- Grandchild ---- Greatgrandchild etc with a many-to-many relationship between the Parent and the Child, so I have an intersecting table between the two conatinging the primary keys of the Parent and Child, which Hibernate manages for me. All well and good so far. As I access the persistant object form a ...

20. Advanced Parent/Child Problem    forum.hibernate.org

Hi All, We have some pretty awkward mapping requirements on the project I'm working on that despite many hours searching and playing with Hibernate I'm not able to solve. The issues are: 1. Every domain object needs a GUID 2. The GUID needs to be able to used in isolation to return the domain object 3. The GUID needs to be ...

21. Strategies with one-to-one parent-child    forum.hibernate.org

Hello, I've recently run into issues in project that I'm working on. We have optional one-to-ones, where there are cases of both PK and FK implementations of the join. The architecture of the application seems to assume a dependant parent-child relationship; that is, nulling the relationship on the left side should kill off the object on the right side. Which means ...

22. How mapping one child to two parents?    forum.hibernate.org

Hi, I need to map a child table to two or more parents. I have a Comments table and a need to create a bag in "Contract" and also on "Customer" with a list of Comments, i have a FK only wiht one table and i have errors when try to persist the other (without FK). I don't know how can ...

23. Parent / child retrieval of object tree not working?    forum.hibernate.org

Newbie Joined: Sun Oct 05, 2003 5:43 pm Posts: 10 Location: Atlanta After reading the parent child section of the manual several times, and trying several different iterations I am at loss how what is wrong. If anyone can shed some light on the problem it would be great !!! Real simply we want to create a parent, with a set ...

24. Parent/Child - Extra table creation    forum.hibernate.org

Hi, I have a special case here: There are two Java objects ObjectA and ObjectB. At the database level, I need to have three tables 1. TableA (for ObjectA) 2. TableB (for ObjectB) 3. TableAB (extra table) The relationship should be of the type: 1. Table A has one-to-many with TableAB (inverse - true) 2. Table AB has one-to-one with TableB ...

25. another Parent/Child Problem (sorry)    forum.hibernate.org

Hy, I'm trying to persist 2 classes Parent and Child: class Parent{ private String id; private Child myPreferedChild; private String name; //getters and setters } class Child{ private String id; private Parent myOnlyParent; private String name; //geters and setters } For the moment, there is no one-to-many relation between parent and childrens (the parent only knows its prefered child). In the ...

26. Example of compound key parent/child relatonship?    forum.hibernate.org

Thanks. But the parent -> child relationship was not the problem. It was the reciprocal relationship--the child accessing the parent. The composite-id of (parentid, childid) didn't seem to get along with the mapping from the child. I got around this by modifying the child hbm.xml mapping so it doesn't consider the parent id part of its key. (No composite id ...

27. parent/child????    forum.hibernate.org

My tree structure behaves strange or does the parent/child really behave this way?Let say i had three records: Media - News -- Sports News When i try to delete News, its children must also be deleted. But what is happening is that even its parent are also deleted. (the whole nodes are deleted). Does a tree structure table in hibernate behave ...

28. Parent-Child, basic question    forum.hibernate.org

In the Parent-Child document: http://www.hibernate.org/155.html a Child is added to the Parent's set and both Parent and Child are saved explicitly. In various postings and other examples with Parent-Child relationship it is only the Parent that is being saved explicitly. I have been playing with a Parent-Child (sort of, I have a composite-id) relationship and Hibernate generates INSERT statement for the ...

29. parent-child in collections    forum.hibernate.org

I have a mapping file parent.hbm.xml which contains set of childs. Parent.hbm.xml ------------------- Child.hbm.xml ---------------- In code: -------- Parent p = new Parent(); //set other parent properties HashSet s = new HashSet(); Child c = new Child(); //set other child properties c.setParent(p); s.add(c); p.setChildSet(c); Session session ...

30. Parent Objects without Childs    forum.hibernate.org

Hello, i could not find any good answer to this. So i try it with a new topic. I have two object as Parent and child. One are PrinterGroups and the other are Printers under the Groups. If i do a query on the PrinterGroups i also get all the Printers in the ArrayList of PrinterGroups returned as ArrayList of PrinterGroups, ...

31. Can parents map children more than once?    forum.hibernate.org

Hey guys, a random question came to me the other day. I've got a parent with an ordered bunch of children mapped in a List. Occasionally, I would like to be able to find a child with a specific name. Yes, I know I can use the session.filter() method on the collection, and that's probably what I will end up doing, ...

32. Parent Child again, have read examples and Documentation    forum.hibernate.org

Beginner Joined: Thu Feb 26, 2004 6:42 pm Posts: 24 I have the following mapping files..

33. Mapping a Set of parent classes    forum.hibernate.org

I have an implementation of java.security.acl.Group that I'm trying to map into Hibernate. The GroupImpl class has a Set of Principals inside it for members of that group. However, I'm having trouble getting the mapping right. Below is the map file...

34. Parent / Child Issue. How to store link to the last child?    forum.hibernate.org

Hello I'm having a problem with a parent child relationship where the parent also stores a link to the most recent child added. The Schema looks like this: Parent id Children LastChild Child id Parent Here is the hibernate modeling information for the parent class: /** * Returns a set of all Children * @hibernate.set table="child" lazy="true" cascade="all" inverse="true" * @hibernate.collection-key ...

35. Parent child problem    forum.hibernate.org

Hi, I am trying the parent child one to many relationship since last 2 days. I read manuals and went through the forum but not very useful. The scenario is I have a UserVO class which can have at the most 2 child AddressVO. The mapping files are as follows Code: ...

36. Parent/child    forum.hibernate.org

id | parent_id --------------------- 0 | 1 1 | 1 0 | 2 1 | 2 ...

37. Inheritance query on parent class and child classes using or    forum.hibernate.org

Newbie Joined: Tue Aug 31, 2004 6:37 pm Posts: 1 Hibernate version: 2.1.6 Mapping documents: Code:

38. Parent/child and inheritance    forum.hibernate.org

Hi there I am having trouble implementing a parent/child relationship, which involves inheritance. Hibernate version: 2.1.6 Database: hypersonic I have three classes: A couple of abstract classes: "Base" class which contains an id; "Node" class which represents a node in a tree structure (with a reference to its parent); and a concrete "Department" class which extends the abstract Node class. public ...

40. Parent/child mapping    forum.hibernate.org

41. Advanced Parent/Child Question    forum.hibernate.org

I have 3 POJOs. They are Contact, Document, and History. I'm trying to set up a parent/child relationship using Contact/History AND Document/History. I want my Contact table and Document table to both share the same History table in the database. Any help on how to create a mapping document for this would be appreciated. Thanks!

42. Howto: Parent/Child (without using a Set)    forum.hibernate.org

Hibernate version:2.1.6 Im trying to map the following construct: A (1..1) -- (0..1) B property accessors + constructors omitted for clarity: class A() { int id; B b; } class B() { int id; A a; } Any single 'A' could contain 0 or 1 'B'. 'B' cannot exist without an associated 'A'. Ive been trying to use many-to-one and one-to-one, ...

43. Parent-Child Single Table, Single Class    forum.hibernate.org

44. How to configure Parent/Children/Grandchildren...    forum.hibernate.org

Hibernate version: 2.1 I could not find a post related to this. Pardon me, if this or related question is already posted. I have the following object hierarchy: 1. Order has orderId as Primary Key (PK). It may have one or more OrderDetail objects 2. OrderDetail has (orderId + orderLineNumber) as PK. Each OrderDetail may have one or more Tax objects ...

45. Problem creating Parent and Child at the same time ?    forum.hibernate.org

Hi, I have a class with a one to many relation to itself (Categories contains Categories). I have no problem setting them right, except when I try to create the parent category and the child category on one turn... Category parentCat = new Category(); parentCat.setTitle(CAT_SIGNATURE); Category childCat = new Category(); childCat.setTitle(CHILDCAT_SIGNATURE); childCat.setParentCategory(parentCat); parentCat.getChildCategories().add(childCat); The last line produce a null exception because ...

46. Parent and Child Objects!    forum.hibernate.org

47. can changes in parent set cause changes in mapped child tbl?    forum.hibernate.org

given the mapping below, i want to be able to do this: CommunityBean cb = getCommunityBean(s); // from CommunityBean community where community.name = ? Set users = cb.getUsers(); users.removeAll(oldUsers); cb.setUsers(users); s.update(cb); i also want to maintain the ability to query within the user set based on the communityName field: from CommunityUserBean user where user.communityName = ? and ... i seem to ...

48. Multiple Parents per child    forum.hibernate.org

Hibernate version:=3 Mapping documents: Code:

49. Mapping parent entities without separate table    forum.hibernate.org

50. Parent-Child mapping with surrogate key    forum.hibernate.org

51. interfaces in 'Getting Parents and Children to Play Nice'    forum.hibernate.org

Well, I can answer my own question. At the very least, XDoclet doesn't support interfaces using the table-per-subclass mapping strategy. As soon as I changed the "implements" keyword to "extends" and made the requisite code changes to switch from an interface to inheritance, xdoclet generated my mapping without issue, putting the joined-subclass elemts into the mapping file for the superclass. With ...

52. parent/child! Writes childs but doesn't read (not always)    forum.hibernate.org

Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message beowulf Post subject: parent/child! Writes childs but doesn't read (not always) Posted: Tue Aug 02, 2005 12:57 pm Newbie Joined: Fri Oct 01, 2004 7:01 am Posts: 3 Grettings I'm having a problem with a parent ...

53. How to map more parents to the same child?    forum.hibernate.org

hi, i have a design question regarding how to map more than one parent to the same child. the relationship between a parent and the child is one to many. the parent objects' id needs to be a number (Long). the business background is that a few objects need to have dated notes regarding when an object was changed, why, etc. ...

54. Parent table with two child tables    forum.hibernate.org

Author Message tjholmes Post subject: Parent table with two child tables Posted: Wed Aug 10, 2005 11:18 am Beginner Joined: Thu Jul 21, 2005 10:28 am Posts: 21 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.5 Mapping documents: Parent Table Code: ...

55. How to change a child's parent?    forum.hibernate.org

56. parent child relationshp    forum.hibernate.org

Newbie Joined: Tue Oct 11, 2005 6:47 am Posts: 5 Hibernate version:2.1 SQL Server Let me start by confessing that I am relatievly new to Hybernate. I have a typical parent child relationship scnario which we are thinking of persisting using hibernate. the scenario: The entities we have here are 1. Form - corresponds to form table in database 2. Page ...

57. Inheritance mapping without mapping parent class.    forum.hibernate.org

Hibernate version: 3.0 Mapping documents: Hello, this is my first post here and I'll try to explain what I'm looking for. Well, First of all, I have two tables in my database, one called RangeRequest and the other one called IpRequest. To implement this situation into java source, I have this structure: Request <- Parent RangeRequest extends Request <-- Child IpRequest ...

58. Inheritance mapping - parent and children unsynchronized    forum.hibernate.org

Hi, I have a following problems I have a entity Service which is a parent to UserService. When I try to save UserService which violates unique constraint on userServiceName child object is not being saved while the parent is and exception is thrown Am i missing something in the mapping? Code: ...

59. problems on setting a parent for a child object    forum.hibernate.org

60. Parent/Child Mapping Questions    forum.hibernate.org

I have a pretty lazy requiremet from the users to save/get/delete the parent object, but it also requires to save/get/delete all of the objects inside the parent object. Put it simple, let's say we have three classes: Class Parent { int parent_id; Set children; //hold the Child objects String pname; } Class Child{ int child_id; Set grandsons; //hold the Grandson objects ...

61. Moving a child object to a different parent    forum.hibernate.org

I am using hibernate 3 and I have a category object mapped with the hibernate mapping included at the bottom of this post It has among others the following methods : public void removeChildCategory(Category category){ if (category == null) { throw new IllegalArgumentException("Category to be removed from category is null"); } category.setParentCategory(null); childCategories.remove(category); } public void addChildCategory(Category category){ if (category == ...

62. parent-child    forum.hibernate.org

63. Is it possible to query a map without a join on the parent?    forum.hibernate.org

Hibernate version: 3.0.5 Hello, So I have the following mapping file and what I'd like to do is build a query to get some of the indexes and elements from the attributeValues Map, based on the ID (key) and ATTRIBUTE_NAME (index) columns of the ATTRIBUTE_VALUES table, all this without a join on the ENT_SPEC_VAL table: Code:

64. Multiple Children of a Given Parent Table?    forum.hibernate.org

I have a situation where I have multiple possible parent objects, all of which could potentially contain the same sort of child objects. Example: public class person { private string id; private string name; private Set Cars; } public class dealership { private string id; private string name; private Set cars; } public class corporation { private string id; private string ...

65. parent having one to many with collection in child    forum.hibernate.org

I have run into a issue moving from our existing DOA to hibernate. I have the follow scenario Class parent { int parentId Child childInstance; } Class child { Vector childCollection; } The child class is kind of a wrapper for the childCollection. There isn't a table for Child but for childCollection which would be like create table ChildCollection (autoId int ...

66. A better approach: one-to-many parent-child ...    forum.hibernate.org

I have a class, called A, with one-to-many parent-child relationship with its child, called B. I need to retrieve a list of A met specific conditions. Not all attributes of A need to be displayed in the list, nor the attributes of the B class, but some statistic data of B class such as the count, the average of one attribute ...

67. can not store parent=child, addChild only accepts 1 child    forum.hibernate.org

Please help me with this. This is literally holding up sending our product to the client. I cannot be in a worse situation. I am sitting here a by myself and I am in trouble. This seems like an easy thing to fix, but I am so exhausted that I just can not seem to find my way out of this ...

68. Child/parent same class    forum.hibernate.org

Hello, im new to hibernate, so i ran into some problems i could not solve even by reading the faq/documents. I have parent class 'A' which can also be the child class. 'A' has a Hashset with all childs. How can i map this ? Every example i found has at least two mapping classes. Level up - i want this ...

69. pb query parent/child where clause condition    forum.hibernate.org

This is correct behaviour. When you do a parent.getChildren it returns the children of the parent. There are 3 and thus you will get 3. Just because you used a restriction to find the parent, doesn't mean that it doesn't have 3 children any more. Thus your logic is to find the parent that has a child in with that name ...

70. How to get the real child object from the parent object    forum.hibernate.org

Hello, everybody I programmed a polymorphism parent-children Pojos like Parent, Child1 extends Parent, Child2 extends Parent, Child3 extends Parent with a table per subclass way. I need to use lazy fetching to all these objects. I get a list of Parent, and I want to iterator them and get each real child object and to do some operations. It's obviously wrong ...

71. Abstract parent/child mapping    forum.hibernate.org

Hibernate version: 3.1.2 I'm having a serious problem in the mapping of a parent child structure where both parent and child are abstract classes that are derived for differente implementation. This is the case: abstract parent and child: public abstract class Parent { Long id; // some properties omitted List childs = new ArrayList(); // getters/setters omitted } public abstract class ...

72. [Hibernate][3.1] Simple bidirectionnal parent-child    forum.hibernate.org

Hello. Hibernate's examples are many... but nevertheless, i did find anything I want... I'm trying top build a very simple relationship with two objects : - orders, with an assigned string id - order items, whose primary key is the order id and a number To make it as simple as possible, i use a simple composite association like this for ...

73. Numerous parents to same child class - how to map it?    forum.hibernate.org

Hibernate version: 3.1.2 Name and version of the database you are using: Oracle 9i I have a scenario like this: There is a number of parent classes which all have a child of same basic abstract type. For each child I have created a subclass that identifies the type and added a discriminator. In one of the parents I have this ...

74. Parent child problem    forum.hibernate.org

75. Getting parent object from a child    forum.hibernate.org

The mappings seem to work fine, infact if I dont try and add query params to the parent I get back all the child records and have no problem in the code drilling up into the parent class. I will take some time to day to simplify the problem and see if it is reproducible at that level then send the ...

76. mapping a where the right-hand table is parent    forum.hibernate.org

Absolutely (or I could get the DBA to write a view) and in fact that is what I am doing in the meantime, but the object model would be cleaner if Hibernate were to allow the to function the other way around. Perhaps I can log that as an enhancement request. What surprises me though is that the and ...

77. child with two parents    forum.hibernate.org

how can i re-use a child definition for two class. i mean two class will have the same child (one-to-many) relationship to i.e. OR. which i think the problem was hibernate created two constraints(hibernate-tools RunSchema) based on my mapping definition. when we manually removed the constraints the application just run fine. so my question is how to do child with two ...

78. simple parent/child mapping question    forum.hibernate.org

I'm trying to create a simple parent/child mapping where the parent has a generated id and I want the child's id to be automatically populated. This isn't happening with the below mappings. I'm saving with a cascade all on the parent object and the parent's id is generated. I read somewhere that a composite doesn't work with a generated id but ...

79. Child to Multiple Parents    forum.hibernate.org

I know the question of mapping a child to multiple polymorphic parents has been asked and discussed but I'm attempting to do something a little different. I need to map a child to two different (not polymorphic) parents. I'm working with a file type where the child record type can appear in different places within the file and I need to ...

80. Question on documentation example of parent-child (21.2)    forum.hibernate.org

I have a question about the example presented in the Hibernate docs at http://www.hibernate.org/hib_docs/v3/reference/en/html/example-parentchild.html (section 21.2) In this example of a Parent-Child relationship, the Child entity is required to contain a reference to the Parent. My question is why this is needed: the parent contains in the mapping the column used as the key in the child table, and the ...

81. One-To-Many Parent with Children in Collection    forum.hibernate.org

I'm using Hibernate 3.0 and MySQL. I cannot get a parent with a collection of children (one-to-many) situation to work. The creation of the child fails on foreign key constraint (parentId not available) I have the exact situation at work and we are using Oracle and sequences for the generation of ids. I supsect that my problem is with using "native" ...

82. Parent/Child problem    forum.hibernate.org

I have two tables: first table contains course,unit,lesson details. second table contains many-to-one relationship between course and units. It means a course contains many units and a unit contains many lessons. First Table: Id content content Name Type 1 course1 course 2 lesson1 lesson 3 lesson2 lesson 4 unit1 unit 5 unit2 unit Second Table: Id refId 2 1 3 1 ...

83. Move child from one parent to another    forum.hibernate.org

Hibernate version:3.1.3 Name and version of the database you are using:Posgtres Hi i have setup a parent child mapping which is working, I can save and update both which works well. I am using inverse='true' and a many-to-one mapping with cascade = all-delete-orphan But my issue comes about when i want to move a child from one parent to another. If ...

84. Adding child to parent entity in many-to-one    forum.hibernate.org

Hi folks, I have a simple entity relationship where a Person can have many Photo. The Person entity has a List, and Photo has a Person class member. At the moment things work just fine as long as I do the following: Person.getPhotos().add(Photo); Photo.setPerson(Person); Do I always have to do it from both sides manually? Is there any way I can ...

85. Parent/Child mapping    forum.hibernate.org

Hi folks, I have a simple table called Dog which has: ID Name Dam Sire where Dam and Sire are self-referencing foreign keys to the Dog.ID column. I have mapped everything to that table successfully except for the uni-directional parent/child mapping. I have mapped the dam and sire properties successfully. It's the "progenies" colletion that's somewhat problematic. Currently I have:

86. Hibernate 3.0 to 3.2; parent does not retreive child objects    forum.hibernate.org

hsession = factory.openSession(); trans = hsession.beginTransaction(); trans.begin(); tag.addRecord(tagRecord);// this is a list. hsession.saveOrUpdate(tag); trans.commit(); ...

87. problem with parent/child    forum.hibernate.org

Hi everybody I have problem with hibernate and parent/child class. This is my .hbm.xml file. and this is ...

88. Another parent/child problem ...    forum.hibernate.org

Hi, I just started to learn hibernate and I found problem regarding parent/child with hibernate. I have 2 tables, Employee & Department where [Department] has one to many [Employee] Department.hbm.xml Code: ...

90. Parent and Child Issue    forum.hibernate.org

Hi Please find the Image here : http://ramsateesh.googlepages.com/index.html I have a persistant object of the parent and I have my mapping file which allows hibernate to create the parentId (primary key). But I have a list of child objects embedded in the parent object which have parentId as their foreign Key. I have cascade all in my parent.hbm.xml file. When I ...

91. Adopting a child to new parent    forum.hibernate.org

Hi, I have a parent-child (one to many) bidirectional relationship, with inverse="true" and cascade="all-delete-orphan". What I'm trying to do is take an existing child (Document) and move it from one parent to a new parent (Batch), then delete the old parent. Hibernate thinks I want the child documents deleted, and says "org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted ...

92. Mapping diffferent parent classes one-to-many set children    forum.hibernate.org

Newbie Joined: Wed May 16, 2007 1:35 pm Posts: 4 Hibernate version: 3.2 Name and version of the database you are using: Oracle 10g As part of the internationalization, I need to replace all the String properties in my classes with multi-language values. The plan is to replace what used to be a String field in my objects with a reference ...

94. Unable to get all Parent and correspond child objects (set)    forum.hibernate.org

Hi, I made an association in parent HBM file with a set of child objects. Also, when i say : Object o = getSessionFactory().openSession().get(DepartmentMaster.class,new Long(101)); i get the parent object with the embedded set of child objects in it. But we need to get all the parent object with the embedded child objects in them. Can you suggest me a solution ...

95. [Parent/Child] Parent included in its children set ?    forum.hibernate.org

Newbie Joined: Thu Jul 12, 2007 4:21 pm Posts: 3 Location: Barboleuse, Switzerland Hi ! I have a parent/child relationship between categories, all stored in the same table. I generated the DAO using Hibernate Synchronizer. When I create a category and ask for its children, the resulting set contains the category itself instead of being empty, as expected. Why is that ...

96. conditional Parent/Child mapping    forum.hibernate.org

Ok, I know there must be an easy solution to this, but it is beyond me at the moment. Here are my entities, pretty basic: Item (1) --> (0..*) Photo Profile (1) --> (0..*) Photo So both Item and Profile have a one-to-many association to Photo, originally I had a table called ItemPhoto and a table called ProfilePhoto, but when I ...

98. Inheritance with diff PrimaryKey in Parent and Child Tables    forum.hibernate.org

Is it Manadatory to have same Primarykey for ParentTable and ChildTable In order to implement Inheritance In the Application?. If it is Possible that we can use different PrimaryKeys for the Parenttable and Child table ,can u give the solution. Plz send me reply as soon as possible Thanks In Advance, Sandeep

99. How to be notified that a child of a parent has been changed    forum.hibernate.org

Here are the maping files: Family (Parent):

100. Child entity with 2 parents. Best practice?    forum.hibernate.org

Hi. I have a pojo child that has to parents mother and father. Lets say the child cant exist without a mother or father. If I delete one of the parents I want the child deleted also. If I delete the mother I dont want the father deletede only the child. Is there a best practice for doing this? From what ...