java.lang.NullPointerException

Hibernate JIRA | Kristof Jozsa | 1 decade ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    A many-to-many collection (User-Role) is mapped the following way: user side: <set name="roles" lazy="false" inverse="true" table="user_roles" cascade="save-update"> <key column="user_name" property-ref="username"/> <many-to-many class="ch.orange.ras.model.Role" column="role_name"/> </set> role side: <set name="users" lazy="true" table="user_roles"> <key column="role_name"/> <many-to-many class="ch.orange.ras.model.User" column="user_name"/> </set> saving a detached User object with a valid set of Roles throws the following exception: java.lang.NullPointerException at org.hibernate.engine.EntityEntry.getLoadedValue(EntityEntry.java:141) at org.hibernate.type.CollectionType.getKeyOfOwner(CollectionType.java:302) at org.hibernate.engine.Collections.processReachableCollection(Collections.java:137) at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64) at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:198) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86) [...] removing the property-ref attribute from User's mapping makes it work, so I believe the bug is related to that new feature.

    Hibernate JIRA | 1 decade ago | Kristof Jozsa
    java.lang.NullPointerException
  2. 0

    A many-to-many collection (User-Role) is mapped the following way: user side: <set name="roles" lazy="false" inverse="true" table="user_roles" cascade="save-update"> <key column="user_name" property-ref="username"/> <many-to-many class="ch.orange.ras.model.Role" column="role_name"/> </set> role side: <set name="users" lazy="true" table="user_roles"> <key column="role_name"/> <many-to-many class="ch.orange.ras.model.User" column="user_name"/> </set> saving a detached User object with a valid set of Roles throws the following exception: java.lang.NullPointerException at org.hibernate.engine.EntityEntry.getLoadedValue(EntityEntry.java:141) at org.hibernate.type.CollectionType.getKeyOfOwner(CollectionType.java:302) at org.hibernate.engine.Collections.processReachableCollection(Collections.java:137) at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64) at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:198) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86) [...] removing the property-ref attribute from User's mapping makes it work, so I believe the bug is related to that new feature.

    Hibernate JIRA | 1 decade ago | Kristof Jozsa
    java.lang.NullPointerException
  3. 0

    Mapping a class as component with array type field

    Coderanch | 8 years ago | M. Saeed
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.engine.EntityEntry.getLoadedValue()
    2. Hibernate
      Collections.processReachableCollection
      1. org.hibernate.engine.EntityEntry.getLoadedValue(EntityEntry.java:141)
      2. org.hibernate.type.CollectionType.getKeyOfOwner(CollectionType.java:302)
      3. org.hibernate.engine.Collections.processReachableCollection(Collections.java:137)
      3 frames
    3. Hibernate
      SessionImpl.managedFlush
      1. org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
      2. org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104)
      3. org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64)
      4. org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58)
      5. org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:198)
      6. org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
      7. org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
      8. org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
      9. org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
      10. org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
      10 frames
    4. Hibernate
      JDBCTransaction.commit
      1. org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
      1 frame