java.lang.NullPointerException

Hibernate JIRA | Christian Drees | 4 years ago
  1. 0

    The Hibernate Developers Guide in version 4.1 writes in chapter "15.11.1 What isn't and will not be supported" " Bags (the corresponding Java type is List), as they can contain non-unique elements. The reason is that persisting, for example a bag of String-s, violates a principle of relational databases: that each table is a set of tuples. In case of bags, however (which require a join table), if there is a duplicate element, the two tuples corresponding to the elements will be the same. Hibernate allows this, however Envers (or more precisely: the database connector) will throw an exception when trying to persist two identical elements, because of a unique constraint violation. There are at least two ways out if you need bag semantics: use an indexed collection, with the @IndexColumn annotation, or provide a unique id for your elements with the @CollectionId annotation." However Envers throws a NullPointerException in OneToMany relations with indexed collections. Stacktrace: java.lang.NullPointerException at org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:75) at org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:39) at org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:67) at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50) at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.size(CollectionProxy.java:55) at org.hibernate.envers.test.tools.TestTools.checkList(TestTools.java:63) at org.hibernate.envers.test.integration.onetomany.IndexedBasicList.testHistoryOfEdId2(IndexedBasicList.java:109)

    Hibernate JIRA | 4 years ago | Christian Drees
    java.lang.NullPointerException
  2. 0

    The Hibernate Developers Guide in version 4.1 writes in chapter "15.11.1 What isn't and will not be supported" " Bags (the corresponding Java type is List), as they can contain non-unique elements. The reason is that persisting, for example a bag of String-s, violates a principle of relational databases: that each table is a set of tuples. In case of bags, however (which require a join table), if there is a duplicate element, the two tuples corresponding to the elements will be the same. Hibernate allows this, however Envers (or more precisely: the database connector) will throw an exception when trying to persist two identical elements, because of a unique constraint violation. There are at least two ways out if you need bag semantics: use an indexed collection, with the @IndexColumn annotation, or provide a unique id for your elements with the @CollectionId annotation." However Envers throws a NullPointerException in OneToMany relations with indexed collections. Stacktrace: java.lang.NullPointerException at org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:75) at org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:39) at org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:67) at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50) at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.size(CollectionProxy.java:55) at org.hibernate.envers.test.tools.TestTools.checkList(TestTools.java:63) at org.hibernate.envers.test.integration.onetomany.IndexedBasicList.testHistoryOfEdId2(IndexedBasicList.java:109)

    Hibernate JIRA | 4 years ago | Christian Drees
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    hibernate envers and ordered lists

    Stack Overflow | 4 years ago | otter606
    java.lang.NullPointerException
  5. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException

    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.NullPointerException

      No message provided

      at org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection()
    2. A Hibernate O/RM Module
      CollectionProxy.size
      1. org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:75)
      2. org.hibernate.envers.entities.mapper.relation.lazy.initializor.ListCollectionInitializor.addToCollection(ListCollectionInitializor.java:39)
      3. org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:67)
      4. org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50)
      5. org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.size(CollectionProxy.java:55)
      5 frames
    3. org.hibernate.envers
      IndexedBasicList.testHistoryOfEdId2
      1. org.hibernate.envers.test.tools.TestTools.checkList(TestTools.java:63)
      2. org.hibernate.envers.test.integration.onetomany.IndexedBasicList.testHistoryOfEdId2(IndexedBasicList.java:109)
      2 frames