Bonjour,
J'ai un soucis à la con (oui comme tout le monde).
j'ai deux table personn(idPersonne, nom, ..)
et personnPref(idPersonne, param,...)
On a bien une relation one-to-one entre les deux table et l'ID de la table personnPref est une reference à l'id de la table personn.
Et donc j'ai pas mal chercher sur le net et je suis arrivé
au mapping suivant :
Alors déjà, est ce que c'est la bonne manière de faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <class name="Personn" table="PERSONN"> <id name="id" column="idPersonn" type="int"> <generator class="native" /> </id> <one-to-one name="personnPref" class="PersonnPref"/> </class> <class name="PersonnPref" table="PERSONN_PREF"> <id name="id" column="idPersonn"> <generator class="foreign"> <param name="property">personn</param> </generator> </id> <one-to-one name="personn" class="Personn" constrained="true" /> <property name="param" type="int" not-null="true" /> </class>
Et sinon j'ai une erreur au niveau de la génération des beans.
Pourtant j'ai bien défini un id. Je ne comprends pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 [hibernatetool] org.hibernate.InvalidMappingException: Could not parse mapping document from resource PersonnPref.hbm.xml [hibernatetool] org.hibernate.MappingException: class PersonnPref not found while looking for property: id [hibernatetool] java.lang.ClassNotFoundException: PersonnPref
Vous auriez une idée ?
Partager