IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

Hibernate Mapping -Error


Sujet :

Hibernate Java

  1. #1
    Membre à l'essai
    Inscrit en
    Juin 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 5
    Par défaut Hibernate Mapping -Error
    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:

    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)
    .
    .
    .
    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
    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.

  2. #2
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Un nom d'attribut doit commencer par une minuscule.
    Essaie déjà en changeant tous tes noms d'attributs.

  3. #3
    Membre à l'essai
    Inscrit en
    Juin 2009
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 5
    Par défaut
    J'ai testé,j'ai changé le nom des attribut en minuscule mais tjs rien(je croi pas

    que le problem vien de la), en faite les hbm on etait cree par Hibernate

    sychroniser mais je personnalise les DAO.Notez que j'ai deja cree des projet avec

    la meme demarche et ca fonctionne, ce meme projet fonctionnait correctement

    avant que je modifier quelque tables dans la Base de donnée.

    D'autre propositions.

    merci d'avance.

Discussions similaires

  1. [Hibernate] mapping d'une collection
    Par Jorus dans le forum Hibernate
    Réponses: 22
    Dernier message: 01/12/2008, 17h16
  2. [Hibernate] Mapping d'association
    Par srvremi dans le forum Hibernate
    Réponses: 2
    Dernier message: 22/01/2006, 04h54
  3. [Hibernate] - Mapping Exception
    Par msiramy dans le forum Hibernate
    Réponses: 3
    Dernier message: 09/01/2006, 16h38
  4. [hibernate] Mapping avec identifiant composé
    Par miky_jo dans le forum Hibernate
    Réponses: 3
    Dernier message: 11/10/2005, 16h48
  5. [JDO]Hibernate : Mapping d'un champ auto-incrémenté
    Par brice.antoine dans le forum Hibernate
    Réponses: 4
    Dernier message: 02/04/2004, 10h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo