-
1. Re: Advaned problems with Jboss and Hibernate !
konstantin.ermakov Nov 10, 2006 10:34 AM (in response to divxyoda)Hi!
I think you should use the composite key as an id in your daughter class, I think it is so in EJB3 spec.
P.S. May the force be with you -
2. Re: Advanced problems with Jboss and Hibernate !
divxyoda Nov 10, 2006 11:43 AM (in response to divxyoda)Hi konstantin thanks alot for your reply, do you mean that i shoul have :
@Entity
@Table(name = "Daughter")
@IdClass(DaughterKey.class)
@PrimaryKeyJoinColumn(name = "Mother_id")
public class Daughter extends Mother{
private String daughter_id;
@Id
private DaughterKey myKey=new DaughterKey();
public Daughter(){
super();
myKey.setMotherId(super.getId());
myKey.setDaughterId(getDaugherId())),
}
//.. getter/setter for all fields
}
instead of :
@Entity
@Table(name = "Daughter")
@IdClass(DaughterKey.class)
@PrimaryKeyJoinColumn(name = "Mother_id")
public class Daughter extends Mother{
@Id
private String daughter_id;
public Daughter(){ super();}
//.. getter/setter for all fields
}
Is it your idea ? -
3. Re: Advanced problems with Jboss and Hibernate !
konstantin.ermakov Nov 13, 2006 8:47 AM (in response to divxyoda)Yes, exactly.
For me it was a big problem to understand how the composite key concept works. But it became clear after I generated some beans from the datbase structure with the JAG product: http://jag.sourceforge.net.
I can recommend you to generate some examples and you will see the best way of Database/ EJB implementation.... -
4. Re: Advaned problems with Jboss and Hibernate !
divxyoda Nov 14, 2006 5:50 AM (in response to divxyoda)Hi konstantin, thanks you so much for your help. I'm gonna try to use JAG. Once again, thanks, i think that i'm on the right way to understand the composite keys mechanism...
Best regards, DivxYoda