org.hibernate.HibernateException: Unable to resolve property: null

Hibernate JIRA | Darren Evenson | 3 years 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

    Starting in 4.2.7, the following association mapping results in an error on flushing (regardless of whether there was a change to the collection). {code:xml} <class name="User" table="`User`"> <id name="name" length="32" /> <map name="groups" table="UserGroup" cascade="all,delete-orphan" > <key column="name" /> <map-key column="groupType" type="integer" /> <many-to-many class="Group" unique="true" > <column name="groupName"/> </many-to-many> </map> </class> {code} Stacktrace: {noformat} org.hibernate.HibernateException: Unable to resolve property: null at org.hibernate.tuple.entity.EntityMetamodel.getPropertyIndex(EntityMetamodel.java:1215) at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyIndex(AbstractEntityPersister.java:2406) at org.hibernate.engine.spi.EntityEntry.getLoadedValue(EntityEntry.java:289) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:188) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:381) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:321) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:298) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:118) at org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:167) at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:158) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:55) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:421) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177) at org.hibernate.test.manytomany.mapunique.ManyToManyUniqueDelOrphanTest.testManyToManyWithCascadeDeleteOrphan(ManyToManyUniqueDelOrphanTest.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:62) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) {noformat} I've attached a test case ({{org.hibernate.test.manytomany.mapunique.ManyToManyUniqueDelOrphanTest}}). The test case succeeds under 4.2.6, but fails under 4.2.7 (and master). I believe this regression was caused by the fix for [HHH-6484|https://hibernate.atlassian.net/browse/HHH-6484].

    Hibernate JIRA | 3 years ago | Darren Evenson
    org.hibernate.HibernateException: Unable to resolve property: null
  2. 0

    Starting in 4.2.7, the following association mapping results in an error on flushing (regardless of whether there was a change to the collection). {code:xml} <class name="User" table="`User`"> <id name="name" length="32" /> <map name="groups" table="UserGroup" cascade="all,delete-orphan" > <key column="name" /> <map-key column="groupType" type="integer" /> <many-to-many class="Group" unique="true" > <column name="groupName"/> </many-to-many> </map> </class> {code} Stacktrace: {noformat} org.hibernate.HibernateException: Unable to resolve property: null at org.hibernate.tuple.entity.EntityMetamodel.getPropertyIndex(EntityMetamodel.java:1215) at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyIndex(AbstractEntityPersister.java:2406) at org.hibernate.engine.spi.EntityEntry.getLoadedValue(EntityEntry.java:289) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:188) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:381) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:321) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:298) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:118) at org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:167) at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:158) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:55) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218) at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:421) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177) at org.hibernate.test.manytomany.mapunique.ManyToManyUniqueDelOrphanTest.testManyToManyWithCascadeDeleteOrphan(ManyToManyUniqueDelOrphanTest.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:62) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) {noformat} I've attached a test case ({{org.hibernate.test.manytomany.mapunique.ManyToManyUniqueDelOrphanTest}}). The test case succeeds under 4.2.6, but fails under 4.2.7 (and master). I believe this regression was caused by the fix for [HHH-6484|https://hibernate.atlassian.net/browse/HHH-6484].

    Hibernate JIRA | 3 years ago | Darren Evenson
    org.hibernate.HibernateException: Unable to resolve property: null
  3. 0

    error for PHOTO

    GitHub | 2 years ago | jluc2808
    org.springframework.orm.hibernate4.HibernateSystemException: An immutable natural identifier of entity org.yamj.core.database.model.Artwork was altered from org.yamj.core.database.model.Person#9243 to org.yamj.core.database.model.Person#9243; nested exception is org.hibernate.HibernateException: An immutable natural identifier of entity org.yamj.core.database.model.Artwork was altered from org.yamj.core.database.model.Person#9243 to org.yamj.core.database.model.Person#9243
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate Alter the ID to null and save again as a new entry

    Stack Overflow | 2 years ago | iProgrammer
    org.springframework.orm.hibernate4.HibernateSystemException: identifier of an instance of com.table.model.Employee was altered from 4 to null; nested exception is org.hibernate.HibernateException: identifier of an instance of com.table.model.Employee was altered from 4 to null
  6. 0

    Hibernate Cannot Recreate Collection While Filter is Enabled

    Stack Overflow | 4 years ago | Saffar
    org.hibernate.HibernateException: cannot recreate collection while filter is enabled: [domain.entity.Member.friends#98304]

  1. tfr 1 times, last 10 months ago
1 unregistered visitors
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. org.hibernate.HibernateException

    Unable to resolve property: null

    at org.hibernate.tuple.entity.EntityMetamodel.getPropertyIndex()
  2. Hibernate
    AbstractTransactionImpl.commit
    1. org.hibernate.tuple.entity.EntityMetamodel.getPropertyIndex(EntityMetamodel.java:1215)
    2. org.hibernate.persister.entity.AbstractEntityPersister.getPropertyIndex(AbstractEntityPersister.java:2406)
    3. org.hibernate.engine.spi.EntityEntry.getLoadedValue(EntityEntry.java:289)
    4. org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:188)
    5. org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:381)
    6. org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:321)
    7. org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:298)
    8. org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161)
    9. org.hibernate.engine.internal.Cascade.cascade(Cascade.java:118)
    10. org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:167)
    11. org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:158)
    12. org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91)
    13. org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:55)
    14. org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1218)
    15. org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:421)
    16. org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
    17. org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177)
    17 frames
  3. org.hibernate.test
    ManyToManyUniqueDelOrphanTest.testManyToManyWithCascadeDeleteOrphan
    1. org.hibernate.test.manytomany.mapunique.ManyToManyUniqueDelOrphanTest.testManyToManyWithCascadeDeleteOrphan(ManyToManyUniqueDelOrphanTest.java:62)
    1 frame
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:606)
    4 frames
  5. JUnit
    FrameworkMethod.invokeExplosively
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    3 frames
  6. A Hibernate O/RM Module
    ExtendedFrameworkMethod.invokeExplosively
    1. org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:62)
    1 frame
  7. JUnit
    FailOnTimeout$StatementThread.run
    1. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    2. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    3. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    4. org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)
    4 frames