java.lang.NullPointerException

Hibernate JIRA | Clement Pang | 5 years ago
  1. 0

    The entity contains the following field: @ManyToMany(cascade = {CascadeType.PERSIST}) @JoinTable( name = "Apples", joinColumns = {@JoinColumn(name = "storeId", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "appleId", nullable = false)} ) public Set<Apple> apples = new HashSet<Apple>(); An exception is thrown when saving the entity: java.lang.NullPointerException at org.hibernate.envers.entities.EntitiesConfigurations.getToPropertyNames(EntitiesConfigurations.java:155) at org.hibernate.envers.event.BaseEnversEventListener.addCollectionChangeWorkUnit(BaseEnversEventListener.java:121) at org.hibernate.envers.event.BaseEnversEventListener.generateBidirectionalCollectionChangeWorkUnits(BaseEnversEventListener.java:90) at org.hibernate.envers.event.EnversPostInsertEventListenerImpl.onPostInsert(EnversPostInsertEventListenerImpl.java:60) at org.hibernate.action.internal.EntityIdentityInsertAction.postInsert(EntityIdentityInsertAction.java:149) at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:102) In that particular method: public Set<String> getToPropertyNames(String fromEntityName, String fromPropertyName, String toEntityName) { Set<String> entityAndParentsNames = getEntityAndParentsNames(fromEntityName); Set<String> toPropertyNames = new HashSet<String>(); for (RelationDescription relationDescription : getRelationDescriptions(toEntityName)) { String relToEntityName = relationDescription.getToEntityName(); String mappedByPropertyName = relationDescription.getMappedByPropertyName(); if (entityAndParentsNames.contains(relToEntityName) && mappedByPropertyName.equals(fromPropertyName)) { toPropertyNames.add(relationDescription.getFromPropertyName()); } } return toPropertyNames; } mappedByPropertyName is null since RelationDescription can have null mappedByPropertyName when invoked at: EntityConfiguration public void addToManyMiddleRelation(String fromPropertyName, String toEntityName) { relations.put(fromPropertyName, new RelationDescription(fromPropertyName, RelationType.TO_MANY_MIDDLE, toEntityName, null, null, null, null, true)); }

    Hibernate JIRA | 5 years ago | Clement Pang
    java.lang.NullPointerException
  2. 0

    The entity contains the following field: @ManyToMany(cascade = {CascadeType.PERSIST}) @JoinTable( name = "Apples", joinColumns = {@JoinColumn(name = "storeId", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "appleId", nullable = false)} ) public Set<Apple> apples = new HashSet<Apple>(); An exception is thrown when saving the entity: java.lang.NullPointerException at org.hibernate.envers.entities.EntitiesConfigurations.getToPropertyNames(EntitiesConfigurations.java:155) at org.hibernate.envers.event.BaseEnversEventListener.addCollectionChangeWorkUnit(BaseEnversEventListener.java:121) at org.hibernate.envers.event.BaseEnversEventListener.generateBidirectionalCollectionChangeWorkUnits(BaseEnversEventListener.java:90) at org.hibernate.envers.event.EnversPostInsertEventListenerImpl.onPostInsert(EnversPostInsertEventListenerImpl.java:60) at org.hibernate.action.internal.EntityIdentityInsertAction.postInsert(EntityIdentityInsertAction.java:149) at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:102) In that particular method: public Set<String> getToPropertyNames(String fromEntityName, String fromPropertyName, String toEntityName) { Set<String> entityAndParentsNames = getEntityAndParentsNames(fromEntityName); Set<String> toPropertyNames = new HashSet<String>(); for (RelationDescription relationDescription : getRelationDescriptions(toEntityName)) { String relToEntityName = relationDescription.getToEntityName(); String mappedByPropertyName = relationDescription.getMappedByPropertyName(); if (entityAndParentsNames.contains(relToEntityName) && mappedByPropertyName.equals(fromPropertyName)) { toPropertyNames.add(relationDescription.getFromPropertyName()); } } return toPropertyNames; } mappedByPropertyName is null since RelationDescription can have null mappedByPropertyName when invoked at: EntityConfiguration public void addToManyMiddleRelation(String fromPropertyName, String toEntityName) { relations.put(fromPropertyName, new RelationDescription(fromPropertyName, RelationType.TO_MANY_MIDDLE, toEntityName, null, null, null, null, true)); }

    Hibernate JIRA | 5 years ago | Clement Pang
    java.lang.NullPointerException
  3. 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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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.EntitiesConfigurations.getToPropertyNames()
    2. A Hibernate O/RM Module
      EnversPostInsertEventListenerImpl.onPostInsert
      1. org.hibernate.envers.entities.EntitiesConfigurations.getToPropertyNames(EntitiesConfigurations.java:155)
      2. org.hibernate.envers.event.BaseEnversEventListener.addCollectionChangeWorkUnit(BaseEnversEventListener.java:121)
      3. org.hibernate.envers.event.BaseEnversEventListener.generateBidirectionalCollectionChangeWorkUnits(BaseEnversEventListener.java:90)
      4. org.hibernate.envers.event.EnversPostInsertEventListenerImpl.onPostInsert(EnversPostInsertEventListenerImpl.java:60)
      4 frames
    3. Hibernate
      EntityIdentityInsertAction.execute
      1. org.hibernate.action.internal.EntityIdentityInsertAction.postInsert(EntityIdentityInsertAction.java:149)
      2. org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:102)
      2 frames