org.hibernate.PropertyAccessException: could not set a field value by reflection setter of org.openxava.sinseq.modelo.Almacen.idkk

openxava | saamondino | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    OpenXava / Discussion / Ayuda (EspaƱol):Campo Autoincremental - Components

    sourceforge.net | 2 years ago
    org.hibernate.PropertyAccessException: could not set a field value by reflection setter of org.openxava.sinseq.modelo.Almacen.idkk
  2. 0

    Campo Autoincremental - Components

    openxava | 1 decade ago | saamondino
    org.hibernate.PropertyAccessException: could not set a field value by reflection setter of org.openxava.sinseq.modelo.Almacen.idkk
  3. 0

    When executing a criteria query with a custom <id> type, hibernate ignores the custom type trying to set a primitive type instead; whereas load() works succesfully : Below is some code that helps reproducing this problem : Example of a custom Identifier Generator : package sample; ... public class CustomIdentifierGenerator implements IdentifierGenerator, PostInsertIdentifierGenerator, Configurable { private static IdentityGenerator hibernateGeneratorDelegate = null; public void configure(Type type, Properties props, Dialect dialect) throws MappingException { hibernateGeneratorDelegate = IdentifierGeneratorFactory.create( "sequence", new LongType(), props, dialect); if (hibernateGeneratorDelegate instanceof Configurable) { ((Configurable) hibernateGeneratorDelegate).configure( new LongType(), props, dialect); } } public Serializable generate(SessionImplementor session, Object object) throws HibernateException { return hibernateGeneratorDelegate.generate(session, object); } public InsertGeneratedIdentifierDelegate getInsertGeneratedIdentifierDelegate( PostInsertIdentityPersister persister, Dialect dialect, boolean isUseGet) throws HibernateException { return hibernateGeneratorDelegate.getInsertGeneratedIdentifierDelegate(persister, dialect, isUseGet); } } Mapping snippet : <class name="sample.SimpleEntity" table="TB_SMP_SIMPLE"> <id name="entityPK" type="sample.LongEntityPK" column="SMP_ID"> <generator class="sample.CustomIdentifierGenerator" /> </id> </class> Entity class : package sample; .... public class SimpleEntity { Query code : SimpleEntity de = new SimpleEntity(); s.save(de); // Read SimpleEntity de2 = (SimpleEntity) s.load(SimpleEntity.class, de .getEntityPK()); assertNotNull(de2); assertEquals(de, de2); // Query Criteria crit = s.createCriteria(SimpleEntity.class); List results = crit.list(); // FAILING!!! IllegalArgumentException in class: it.unimaticaspa.unique.pe.spec.entity.EntityBase, setter method of property: entityPK // expected type: it.unimaticaspa.unique.pe.spec.entity.IEntityPK, actual value: java.lang.Long Logs : IllegalArgumentException in class: it.unimaticaspa.unique.pe.spec.entity.EntityBase, setter method of property: entityPK expected type: it.unimaticaspa.unique.pe.spec.entity.IEntityPK, actual value: java.lang.Long Error StackTrace: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of it.unimaticaspa.unique.pe.spec.entity.EntityBase.entityPK at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104) at org.hibernate.tuple.entity.AbstractEntityTuplizer.setIdentifier(AbstractEntityTuplizer.java:211) at org.hibernate.tuple.entity.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:353) at org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:3600) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1275) ... at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42) ... 35 more

    Hibernate JIRA | 1 decade ago | Luca Dall'Olio
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of it.unimaticaspa.unique.pe.spec.entity.EntityBase.entityPK
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    When executing a criteria query with a custom <id> type, hibernate ignores the custom type trying to set a primitive type instead; whereas load() works succesfully : Below is some code that helps reproducing this problem : Example of a custom Identifier Generator : package sample; ... public class CustomIdentifierGenerator implements IdentifierGenerator, PostInsertIdentifierGenerator, Configurable { private static IdentityGenerator hibernateGeneratorDelegate = null; public void configure(Type type, Properties props, Dialect dialect) throws MappingException { hibernateGeneratorDelegate = IdentifierGeneratorFactory.create( "sequence", new LongType(), props, dialect); if (hibernateGeneratorDelegate instanceof Configurable) { ((Configurable) hibernateGeneratorDelegate).configure( new LongType(), props, dialect); } } public Serializable generate(SessionImplementor session, Object object) throws HibernateException { return hibernateGeneratorDelegate.generate(session, object); } public InsertGeneratedIdentifierDelegate getInsertGeneratedIdentifierDelegate( PostInsertIdentityPersister persister, Dialect dialect, boolean isUseGet) throws HibernateException { return hibernateGeneratorDelegate.getInsertGeneratedIdentifierDelegate(persister, dialect, isUseGet); } } Mapping snippet : <class name="sample.SimpleEntity" table="TB_SMP_SIMPLE"> <id name="entityPK" type="sample.LongEntityPK" column="SMP_ID"> <generator class="sample.CustomIdentifierGenerator" /> </id> </class> Entity class : package sample; .... public class SimpleEntity { Query code : SimpleEntity de = new SimpleEntity(); s.save(de); // Read SimpleEntity de2 = (SimpleEntity) s.load(SimpleEntity.class, de .getEntityPK()); assertNotNull(de2); assertEquals(de, de2); // Query Criteria crit = s.createCriteria(SimpleEntity.class); List results = crit.list(); // FAILING!!! IllegalArgumentException in class: it.unimaticaspa.unique.pe.spec.entity.EntityBase, setter method of property: entityPK // expected type: it.unimaticaspa.unique.pe.spec.entity.IEntityPK, actual value: java.lang.Long Logs : IllegalArgumentException in class: it.unimaticaspa.unique.pe.spec.entity.EntityBase, setter method of property: entityPK expected type: it.unimaticaspa.unique.pe.spec.entity.IEntityPK, actual value: java.lang.Long Error StackTrace: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of it.unimaticaspa.unique.pe.spec.entity.EntityBase.entityPK at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104) at org.hibernate.tuple.entity.AbstractEntityTuplizer.setIdentifier(AbstractEntityTuplizer.java:211) at org.hibernate.tuple.entity.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:353) at org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:3600) at org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1275) ... at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42) ... 35 more

    Hibernate JIRA | 1 decade ago | Luca Dall'Olio
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of it.unimaticaspa.unique.pe.spec.entity.EntityBase.entityPK
  6. 0

    could not set a field value by reflection setter of models.User.avatar

    Google Groups | 6 years ago | McGivrer
    org.hibernate.PropertyAccessException: could not set a > field value by reflection setter of models.User.avatar at org.hibernate.property.DirectPropertyAccessor > $DirectSetter.set(DirectPropertyAccessor.java:151) at > org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java: > 586) at > org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java: > 231) at > org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java: > 3824) at > org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java: > 153) at > org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java: > 898)

    Root Cause Analysis

    1. org.hibernate.PropertyAccessException

      could not set a field value by reflection setter of org.openxava.sinseq.modelo.Almacen.idkk

      at org.hibernate.property.DirectPropertyAccessor$DirectSetter.set()
    2. Hibernate
      AbstractEntityPersister.instantiate
      1. org.hibernate.property.DirectPropertyAccessor$DirectSetter.set(DirectPropertyAccessor.java:82)
      2. org.hibernate.tuple.AbstractEntityTuplizer.setIdentifier(AbstractEntityTuplizer.java:204)
      3. org.hibernate.tuple.AbstractEntityTuplizer.instantiate(AbstractEntityTuplizer.java:346)
      4. org.hibernate.persister.entity.AbstractEntityPersister.instantiate(AbstractEntityPersister.java:3272)
      4 frames
    3. Hibernate
      SessionImpl.instantiate
      1. org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1260)
      2. org.hibernate.impl.SessionImpl.instantiate(SessionImpl.java:1249)
      2 frames
    4. Hibernate
      Loader.doQuery
      1. org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1291)
      2. org.hibernate.loader.Loader.getRow(Loader.java:1197)
      3. org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569)
      4. org.hibernate.loader.Loader.doQuery(Loader.java:689)
      4 frames