Well, if a Child can only exist if there's a Parent, then there is a relationship between them. You may just not want to express in OO, but it does exist in the relational model.
Because that one needs to have a back reference to the parent from child which is not desirable Well, if a Child can only exist if there's a Parent, then there is a relationship between them. You may just not want to express in OO, but it does exist in the relational model. That said, I would say that the natural solution for this is to have a Parent in the Child.
But if you really don't want to do that, I would suggest taking a look at mapping the ID as a PK class, and share them with both classes, using an @EmbeddedId. I'm pretty sure it would solve your problem, with one exception: If I try to persist a "standalone" child (e.g. EntityManager. Persist(aChild)) I would expect a RuntimeException.
If you decide to use the @EmbeddedId approach in a PK class, I think you'll need to handle the above case as a "business rule".
1 Partenon, thanks for your answer. Are you sure that the EmbeddedId of the child would be populated after the parent's id was received from the DB sequence? – Korgen Jan 24 at 7:21.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.