This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I think I am doing something that is very basic, incorrectly.
I have a parent child relation ship in my db and I am trying to save data.Data gets properly saved into parent table but it does not get saved into child table.
I have defined OneToMany relation in parent table and ManyToOne in child table.All of import statements are importing javax.persistence classes (can that be an issue?).
Another thing is that child class is child of two classes(It has two columns that have ManyToOne relations).Is that an issue?
Parent class :-
Child class -
Data should be saved in CustomerCsoProfileMap when data is inserted in CsoProfile.There is no error in logs.Also I see the insert statement for parent class and also the sequencename.nextval for parent class sequence in logs.I do not see any statement in logs for child class at all.
What am I doing wrong?
Thanks James.So you mean I have to write code to save data into both Parent and child tables?In that case,what is the use of putting relationship between parent and child(one-to-many and many-to-one)?
Just for getting all children from parent and getting parent from child?
Joined: Jun 19, 2004
Can someone please reply to above post?
I have another question as well(somewhat related).
Suppose I have a parent entity and child entity.I have set up one-to-many in parent and many-to-one in child correctly.
Now when setting up parent's attribute,I set the attribute of embedded child object as well.Something like this -