EJB design: Hibernate Composite Id
Hi Ppl, I'm currently using Spring and Hibernate to develope a web app. I have a db design of a parent to child with one to many. Below is the way I implement my hibernate mapping. I have tried to extract data out and it working fine., having both Parent bean and the list of childrens in the parent bean. When I try to insert, I generate the Parent bean and the list of Childrens. However the insertion always fails. As im using Seq of DB to generate the edy_oid, theres no way beforehand I will know the value so that i can insert my children. Is there a better way to do this? Parent.java ========== public Long getEdy_Oid(); public String getValue1(); public List getChild(); //and similar setter Child.java ========== public Long getEdy_Oid(); public Long getCdy_Oid(); public BigDecimal getTargeAmt(); //and similar setter Hibernate ========= SEQ_EDY_OID
Have seen a similar solution @ http://simoes.org/docs/hibernate-2.1/155.html however its child has its own pk. and it just append onto the fk with is the parent_id. what i need is child treated the parent_id as a composite key which is also a seq from db... any advise?
Hi Winston, I am facing the same problem that you faced before. If you found a solution, can you share it with me? Thanks, Gautam