org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of cat.cis.portal.supplier.CWSHelp.persistence.EntityPO.entityId

Hibernate JIRA | Ben Geyer | 1 decade ago
  1. 0

    When I try to define a query by criteria on an object with a many to one relationship, it throws an IllegalArgumentException on the referred to object. Anyone have any ideas on what is causing this? When I change to using HQL instead, it seems to all work correctly. Request Class has a many to one relation with EntityPO ... <many-to-one name="EntityByApproverEntityId" class="cat.EntityPO" not-null="true" cascade="none" lazy="false" > <column name="APPROVER_ENTITY_ID" /> </many-to-one> ... Here's the table def for Request: CAR_ID NOT NULL NUMBER(10) REQUEST_TYPE_CODE NOT NULL CHAR(1) PROCESSED_DATETIME DATE REQUEST_STATE_CODE NOT NULL CHAR(1) REQUESTER_ENTITY_ID NOT NULL NUMBER(10) APPROVER_ENTITY_ID NOT NULL NUMBER(10) LOGIN_ID VARCHAR2(50) AFFILIATED_ORG_CODE VARCHAR2(30) SUBMITTED_DATETIME DATE APPROVED_DATETIME DATE DELEGATE_ENTITY_ID NUMBER(10) EntityPO Class has this: ... <set name="CWSAccountRequestsByApproverEntityId" lazy="false" inverse="false" cascade="none" > <key> <column name="APPROVER_ENTITY_ID" /> </key> <one-to-many class="cat.CWSAccountRequestPO" /> </set> Here's the table def for Entity: ENTITY_ID NOT NULL NUMBER(10) ENTITY_TYPE_CODE NOT NULL CHAR(1) FIRST_NAME NOT NULL VARCHAR2(30) LAST_NAME NOT NULL VARCHAR2(30) MIDDLE_INITIAL VARCHAR2(10) EMAIL_ADDRESS VARCHAR2(100) CUPID VARCHAR2(32) PHONE_NUMBER VARCHAR2(25) Here's the code that I use: criteria = session.createCriteria(CWSAccountRequestPO.class); criteria.add(Expression.eq("requestTypeCode", Constants.REQUEST_TYPE_NEW)); criteria.add(Expression.in("EntityByApproverEntityId", approverIds)); retVal = criteria.list(); The query looks fine. Here it is: select this_.CAR_ID as CAR1_0_, this_.REQUEST_TYPE_CODE as REQUEST2_0_0_, this_.PROCESSED_DATETIME as PROCESSED3_0_0_, this_.REQUEST_STATE_CODE as REQUEST4_0_0_, this_.LOGIN_ID as LOGIN5_0_0_, this_.AFFILIATED_ORG_CODE as AFFILIATED6_0_0_, this_.SUBMITTED_DATETIME as SUBMITTED7_0_0_, this_.APPROVED_DATETIME as APPROVED8_0_0_, this_.DELEGATE_ENTITY_ID as DELEGATE9_0_0_, this_.APPROVER_ENTITY_ID as APPROVER10_0_0_, this_.REQUESTER_ENTITY_ID as REQUESTER11_0_0_ from CWS_ACCOUNT_REQUESTS this_ where this_.REQUEST_TYPE_CODE=? and this_.APPROVER_ENTITY_ID in (?) Here's the stack trace I see. org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of cat.cis.portal.supplier.CWSHelp.persistence.EntityPO.entityId at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) at junit.framework.TestResult.runProtected(TestResult.java:135) at junit.framework.TestResult.run(TestResult.java:112) at junit.framework.TestCase.run(TestCase.java:119) at junit.framework.TestSuite.runTest(TestSuite.java:209) at junit.framework.TestSuite.run(TestSuite.java:205) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:399) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) at junit.framework.TestSuite.run(TestSuite.java:205) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:399) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) at org.hibernate.loader.Loader.list(Loader.java:1498) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class at org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:117) at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2947) at org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2752) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:185) at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:217) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:94) at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:50) at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1045) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1130) at org.hibernate.loader.Loader.doQuery(Loader.java:415) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:212) at org.hibernate.loader.Loader.doList(Loader.java:1532) at org.hibernate.loader.Loader.list(Loader.java:1498) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1262) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:302) at cat.cis.portal.supplier.CWSHelp.factory.RequestFactory.getNewRequestsForApprover(RequestFactory.java:95) at cat.cis.portal.supplier.CWSHelp.factory.RequestFactoryTest.testGetNewRequestsForApproverWithArray(RequestFactoryTest.java:77) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:132) at junit.framework.TestResult$1.protect(TestResult.java:107) at junit.framework.TestResult.runProtected(TestResult.java:135) at junit.framework.TestResult.run(TestResult.java:112) at junit.framework.TestCase.run(TestCase.java:119) at junit.framework.TestSuite.runTest(TestSuite.java:209) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288)

    Hibernate JIRA | 1 decade ago | Ben Geyer
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of cat.cis.portal.supplier.CWSHelp.persistence.EntityPO.entityId
  2. 0

    When I try to define a query by criteria on an object with a many to one relationship, it throws an IllegalArgumentException on the referred to object. Anyone have any ideas on what is causing this? When I change to using HQL instead, it seems to all work correctly. Request Class has a many to one relation with EntityPO ... <many-to-one name="EntityByApproverEntityId" class="cat.EntityPO" not-null="true" cascade="none" lazy="false" > <column name="APPROVER_ENTITY_ID" /> </many-to-one> ... Here's the table def for Request: CAR_ID NOT NULL NUMBER(10) REQUEST_TYPE_CODE NOT NULL CHAR(1) PROCESSED_DATETIME DATE REQUEST_STATE_CODE NOT NULL CHAR(1) REQUESTER_ENTITY_ID NOT NULL NUMBER(10) APPROVER_ENTITY_ID NOT NULL NUMBER(10) LOGIN_ID VARCHAR2(50) AFFILIATED_ORG_CODE VARCHAR2(30) SUBMITTED_DATETIME DATE APPROVED_DATETIME DATE DELEGATE_ENTITY_ID NUMBER(10) EntityPO Class has this: ... <set name="CWSAccountRequestsByApproverEntityId" lazy="false" inverse="false" cascade="none" > <key> <column name="APPROVER_ENTITY_ID" /> </key> <one-to-many class="cat.CWSAccountRequestPO" /> </set> Here's the table def for Entity: ENTITY_ID NOT NULL NUMBER(10) ENTITY_TYPE_CODE NOT NULL CHAR(1) FIRST_NAME NOT NULL VARCHAR2(30) LAST_NAME NOT NULL VARCHAR2(30) MIDDLE_INITIAL VARCHAR2(10) EMAIL_ADDRESS VARCHAR2(100) CUPID VARCHAR2(32) PHONE_NUMBER VARCHAR2(25) Here's the code that I use: criteria = session.createCriteria(CWSAccountRequestPO.class); criteria.add(Expression.eq("requestTypeCode", Constants.REQUEST_TYPE_NEW)); criteria.add(Expression.in("EntityByApproverEntityId", approverIds)); retVal = criteria.list(); The query looks fine. Here it is: select this_.CAR_ID as CAR1_0_, this_.REQUEST_TYPE_CODE as REQUEST2_0_0_, this_.PROCESSED_DATETIME as PROCESSED3_0_0_, this_.REQUEST_STATE_CODE as REQUEST4_0_0_, this_.LOGIN_ID as LOGIN5_0_0_, this_.AFFILIATED_ORG_CODE as AFFILIATED6_0_0_, this_.SUBMITTED_DATETIME as SUBMITTED7_0_0_, this_.APPROVED_DATETIME as APPROVED8_0_0_, this_.DELEGATE_ENTITY_ID as DELEGATE9_0_0_, this_.APPROVER_ENTITY_ID as APPROVER10_0_0_, this_.REQUESTER_ENTITY_ID as REQUESTER11_0_0_ from CWS_ACCOUNT_REQUESTS this_ where this_.REQUEST_TYPE_CODE=? and this_.APPROVER_ENTITY_ID in (?) Here's the stack trace I see. org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of cat.cis.portal.supplier.CWSHelp.persistence.EntityPO.entityId at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) at junit.framework.TestResult.runProtected(TestResult.java:135) at junit.framework.TestResult.run(TestResult.java:112) at junit.framework.TestCase.run(TestCase.java:119) at junit.framework.TestSuite.runTest(TestSuite.java:209) at junit.framework.TestSuite.run(TestSuite.java:205) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:399) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) at junit.framework.TestSuite.run(TestSuite.java:205) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:399) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) at org.hibernate.loader.Loader.list(Loader.java:1498) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:170) Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class at org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:117) at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2947) at org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2752) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:185) at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:217) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:94) at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:50) at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1045) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1130) at org.hibernate.loader.Loader.doQuery(Loader.java:415) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:212) at org.hibernate.loader.Loader.doList(Loader.java:1532) at org.hibernate.loader.Loader.list(Loader.java:1498) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1262) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:302) at cat.cis.portal.supplier.CWSHelp.factory.RequestFactory.getNewRequestsForApprover(RequestFactory.java:95) at cat.cis.portal.supplier.CWSHelp.factory.RequestFactoryTest.testGetNewRequestsForApproverWithArray(RequestFactoryTest.java:77) at java.lang.reflect.Method.invoke(Native Method) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:132) at junit.framework.TestResult$1.protect(TestResult.java:107) at junit.framework.TestResult.runProtected(TestResult.java:135) at junit.framework.TestResult.run(TestResult.java:112) at junit.framework.TestCase.run(TestCase.java:119) at junit.framework.TestSuite.runTest(TestSuite.java:209) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288)

    Hibernate JIRA | 1 decade ago | Ben Geyer
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of cat.cis.portal.supplier.CWSHelp.persistence.EntityPO.entityId
  3. 0

    Annotations mapping and Enumeration uses wrong value

    Coderanch | 8 years ago | Sverre Moe
    java.lang.IllegalArgumentException: Unknown name value for enum class no.bbs.bkad.domain.bankkunde.KundeAutomatiskOppdatering: 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [GROOVY-2583] "object is not an instance of declaring class" thrown invoking a method on Groovy class, wrapped in a Spring proxy - ASF JIRA

    apache.org | 1 year ago
    java.lang.IllegalArgumentException: object is not an instance of declaring class

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      object is not an instance of declaring class

      at org.hibernate.tuple.AbstractTuplizer.getIdentifier()
    2. Hibernate
      CriteriaLoader.list
      1. org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:117)
      2. org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2947)
      3. org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2752)
      4. org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:185)
      5. org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:217)
      6. org.hibernate.type.EntityType.getIdentifier(EntityType.java:94)
      7. org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:50)
      8. org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1045)
      9. org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1130)
      10. org.hibernate.loader.Loader.doQuery(Loader.java:415)
      11. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:212)
      12. org.hibernate.loader.Loader.doList(Loader.java:1532)
      13. org.hibernate.loader.Loader.list(Loader.java:1498)
      14. org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111)
      14 frames
    3. Hibernate
      CriteriaImpl.list
      1. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1262)
      2. org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:302)
      2 frames
    4. cat.cis.portal
      RequestFactoryTest.testGetNewRequestsForApproverWithArray
      1. cat.cis.portal.supplier.CWSHelp.factory.RequestFactory.getNewRequestsForApprover(RequestFactory.java:95)
      2. cat.cis.portal.supplier.CWSHelp.factory.RequestFactoryTest.testGetNewRequestsForApproverWithArray(RequestFactoryTest.java:77)
      2 frames
    5. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    6. JUnit
      TestSuite.runTest
      1. junit.framework.TestCase.runTest(TestCase.java:164)
      2. junit.framework.TestCase.runBare(TestCase.java:132)
      3. junit.framework.TestResult$1.protect(TestResult.java:107)
      4. junit.framework.TestResult.runProtected(TestResult.java:135)
      5. junit.framework.TestResult.run(TestResult.java:112)
      6. junit.framework.TestCase.run(TestCase.java:119)
      7. junit.framework.TestSuite.runTest(TestSuite.java:209)
      7 frames
    7. JUnit3 Runner
      RemoteTestRunner.run
      1. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:288)
      1 frame