Mon problem est que j'ai besoin d'un identifiant auto-increment pour la table
Dossier mais quant je change <generator class="assigned" /> en "native" ou
n'import quel autre attribut ca m'affiche l'erreur suivante:
voici mon Hbm:
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 Erreur: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of dao.Dossier.CodeDossier Exception in thread "main" java.lang.ExceptionInInitializerError at Util.HibernateUtil.<clinit>(HibernateUtil.java:49) at dao.DossierCRUD.insertionDossier(DossierCRUD.java:19) at Util.HibernateMenu.main(HibernateMenu.java:128) Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of dao.Dossier.CodeDossier at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:119) at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:44) at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:42) at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:107) at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:87) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58) . . .
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44 <?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="dao"> <class name="Dossier" table="dossier"> <id column="CODE_DOSSIER" name="CodeDossier" type="integer"> <generator class="native" /> </id> <property column="TACHE_DOSSIER" length="50" name="TacheDossier" not-null="false" type="string" /> <property column="ETAT_DOSSIER" length="50" name="EtatDossier" not-null="false" type="string" /> <many-to-one class="Personne" name="CodePersonne" not-null="true"> <column name="CODE_PERSONNE" /> </many-to-one> <set inverse="true" name="ProfilAccesTempSet"> <key column="CODE_DOSSIER" /> <one-to-many class="ProfilAccesTemp" /> </set> <set cascade="all" name="ProfilAccesSet" table="dossier_profil_acces"> <key column="CODE_DOSSIER" /> <many-to-many class="ProfilAcces" column="CODE_PROFIL_ACCES" /> </set> <joined-subclass name="PersonneTemp" table="personne_temp"> <key column="CODE_PERSONNE_TEMP" /> <property column="JOB_PERSONNE_TEMP" length="50" name="JobPersonneTemp" not-null="false" type="string" /> <property column="STATUT_PERSONNE_TEMP" length="50" name="StatutPersonneTemp" not-null="false" type="string" /> <property column="CIN_PERSONNE_TEMP" length="10" name="CinPersonneTemp" not-null="false" type="integer" /> <property column="PHONE_PERSONNE_TEMP" length="50" name="PhonePersonneTemp" not-null="false" type="string" /> <property column="NOM_PERSONNE_TEMP" length="50" name="NomPersonneTemp" not-null="false" type="string" /> <property column="PRENOM_PERSONNE_TEMP" length="50" name="PrenomPersonneTemp" not-null="false" type="string" /> </joined-subclass> </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 public class Dossier { private Set<Journal> JournalSet = new HashSet<Journal>(0); private Set<ProfilAcces> ProfilAccesSet = new HashSet<ProfilAcces>(0); private Set<ProfilAccesTemp> ProfilAccesTempSet = new HashSet<ProfilAccesTemp>(0); Personne CodePersonne; String TacheDossier; Integer CodeDossier; String EtatDossier; public Integer getCodeDossier() { return CodeDossier; } public void setCodeDossier(Integer codeDossier) { CodeDossier = codeDossier; } . . .
Toute les get/set sont definie.
Votre aide est la bienvenue.
Partager