These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Gros probleme avec Hibernate et JBoss !
PostPosted: Fri Nov 10, 2006 11:13 am 
Newbie

Joined: Fri Nov 10, 2006 10:23 am
Posts: 2
Bonjour, regardez ces queques Classes pour mieux comprendre le probleme que je soumets a la fin, j'utilise Jboss 4.0.4RC1.


@Entity
@Table(name=Mother)
@Inheritance(strategy = InheritanceType.JOINED)
public class Mother implements Serializable{
@Id
private String mother_id;
public Mother(){}

//... getters/setters pour le champ
}

Note : La table Mother a un cle primaire : mother_id



@Embeddable
public Class DaughterKey implements Serializable{
private String mother_Id;
private String daughter_id;
public DaughterKey(){}

//getters/setters pour les 2 champs

// Les methodes: toString(),hasCode(),equals() sont overridees
}

Note : Cette class aide lors des mappings pour une classe a cle composee.



@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
}

Note: La table Daughter a une cle primaire composee : (mother_Id+daughter_id).




Dans mon intention, je voudrais que : meme si la classe mere (mother) a une seule cle primaire, la fille (daughter) doit en avoir 2 (celle de sa mere et la sienne) : cle composee.

Quand je deploie un jar genere (apres compilation), voici l'exception que j'ai :

java.lang.reflect.InvocationTargetException
//.... at ....
caused by :
org.hibernate.AnnotationException : Unable to define/override @Id(s) on a subclass : Daughter.

Merci a tous ceux qui peuvent aider, car mes connaissances sont limitees, j'ai du mal a faire mieux : merci d'avance !

N'hesitez pas a poser des questions si vous ne comprenez pas trop mon idee.

Cordialement, Divx.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.