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 :

IllegalArgumentException occurred calling getter


Sujet :

Hibernate Java

  1. #1
    Membre confirmé
    Inscrit en
    Avril 2008
    Messages
    184
    Détails du profil
    Informations personnelles :
    Âge : 49

    Informations forums :
    Inscription : Avril 2008
    Messages : 184
    Par défaut IllegalArgumentException occurred calling getter
    Bonjour,

    J'ai une exception "IllegalArgumentException occurred calling getter" et je n'arrive pas a comprendre d'ou cela vient.

    Voila mon 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
    <hibernate-mapping>
        <class name="com.fdilogbox.val2000mapping.bean.Paramfp" table="Paramfp">
            <meta attribute="generated-class">com.fdilogbox.val2000mapping.bean.base.Paramfp</meta>
            <composite-id class="com.fdilogbox.val2000mapping.bean.ParamfpPK" name="id">
                <meta attribute="generated-class">com.fdilogbox.val2000mapping.bean.base.ParamfpPK</meta>
                <key-many-to-one class="com.fdilogbox.val2000mapping.bean.Filfdip" name="filiale" column="obnumfillb"/>
                <key-property name="code_parametre" type="string">
                    <column length="10" name="obcodparpf"/>
                </key-property>
                <key-property name="num_ordre" type="integer">
                    <column name="obnumorpf"/>
                </key-property>
            </composite-id>
    ....
        </class>
    </hibernate-mapping>
    L'exeption vient lorsque je fais une recherche via ma classe DAO :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
            Criteria criteria = getSession().createCriteria(Paramfp.class);
            criteria.add(Property.forName("id.filiale").eq(num_fil));
            criteria.add(Property.forName("code_parametre").eq(parametre));
     
            return criteria.list();
    Le debugger sur la classe "org.hibernate.property.BasicPropertyAccessor$BasicGetter.get" me donne :
    Target : "ARBITRAGE"
    Clazz : class com.fdilogbox.val2000mapping.bean.base.ParamfpPK
    property name : "filiale"

    Le plus etonnant c'est que la valeur de la target ne correspond pas a l'attribut "filiale" mais a l'attribut "code_parametre".

    Une idée du problème?

    Ps: je tourne sur la version 3.5.3-Final d'Hibernate

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    on peut avoir le message d'erreur complet? (printStackTrace)

    aussi, ceci ne serait-il pas plus correct?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
            Criteria criteria = getSession().createCriteria(Paramfp.class);
            criteria.add(Restriction.eq("id.filiale",num_fil));
            criteria.add(Restriction.eq("code_parametre",parametre));
     
            return criteria.list

  3. #3
    Membre confirmé
    Inscrit en
    Avril 2008
    Messages
    184
    Détails du profil
    Informations personnelles :
    Âge : 49

    Informations forums :
    Inscription : Avril 2008
    Messages : 184
    Par défaut
    Bien sur (pour les 2 ).

    Voila le message d'erreur :
    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
    IllegalArgumentException occurred calling getter of com.fdilogbox.val2000mapping.bean.base.ParamfpPK.filiale
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.fdilogbox.val2000mapping.bean.base.ParamfpPK.filiale
            at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:198)
            at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:77)
            at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:83)
            at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:108)
            at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:381)
            at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:212)
            at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:126)
            at org.hibernate.engine.EntityKey.<init>(EntityKey.java:70)
            at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:733)
            at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1037)
            at org.hibernate.loader.Loader.readCollectionElements(Loader.java:690)
            at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:630)
            at org.hibernate.loader.Loader.doQuery(Loader.java:745)
            at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
            at org.hibernate.loader.Loader.loadCollection(Loader.java:2062)
            at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62)
            at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:628)
            at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
            at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1853)
            at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
            at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:899)
            at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:275)
            at org.hibernate.loader.Loader.doList(Loader.java:2294)
            at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
            at org.hibernate.loader.Loader.list(Loader.java:2167)
            at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
            at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
            at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
            at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
            at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
            at com.fdilogbox.val2000mapping.bean.ParamfpDAO.findByNumfilParametre(ParamfpDAO.java:22)
            at com.fdilogbox.val2000mapping.bean.ParamfpTest.testGetValeurs(ParamfpTest.java:66)
    Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3deff3
            at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:172)

Discussions similaires

  1. Réponses: 0
    Dernier message: 27/06/2012, 16h21
  2. [Mapping] Erreur "IllegalArgumentException occurred while calling setter of"
    Par Thibaut Marmin dans le forum Hibernate
    Réponses: 0
    Dernier message: 24/03/2012, 01h24
  3. IllegalArgumentException occurred calling getter
    Par zerocoolyoussef dans le forum Hibernate
    Réponses: 1
    Dernier message: 19/01/2009, 10h10
  4. Réponses: 10
    Dernier message: 29/10/2008, 09h33
  5. Première occurence d'une donnée
    Par bob33 dans le forum MS SQL Server
    Réponses: 3
    Dernier message: 10/06/2003, 13h50

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