Bonjour,
j'ai un problème avec le mapping des listes, je veux ajouter une liste de domiciliation a ma mon produitclient, donc je défini un mapping de cette manière :
Mapping produit_client :
mapping domiciliation :
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 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="fr.icdc.dei.erel.metier.entite.impl"> <class name="ProduitClientImpl" table="TA_PRODUIT_CLIENT"> <id column="PRODUIT_CLIENT_ID" name="ProduitClientID" type="integer" > <generator class="native" /> </id> ......mapping autre attribut <list name="listDomiciliation" lazy="false" > <key column="PRODUIT_CLIENT_ID" not-null="true" /> <index column="TYPE_OPERATION_ID"/> <one-to-many class="DomiciliationImpl" /> </list> </class> </hibernate-mapping>
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
26
27
28
29
30 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="fr.icdc.dei.erel.metier.entite.impl"> <class name="DomiciliationImpl" table="TA_DOMICILIATION"> <id column="DOMICILIATION_ID" name="DomiciliationID" type="integer" > <generator class="native" /> </id> ......mapping autre attribut <property column="TYPE_OPERATION_ID" length="10" name="TypeOperationId" not-null="true" type="integer" insert="false" update="false" /> </class> </hibernate-mapping>
mon problème est le suivant : à la récupération de mon produit client, j'ai une liste de domiciliation qui contient l'objet null comme premier element, puis ma liste, et la taille est donc toujours = vraie taille + 1 (c'est comme si j'ai une domiciliation a null dans ma liste).
si je fais le débug j'ai ca ==> list = {null, fr...entite.Domiciliation}
quel mapping doit je mettre pour enlever ce null dans ma liste ??
une autre question : puis je mettre dans l'index l'id de ma table domiciliation ?
merci par avance pour votre aide.
Partager