java.lang.NullPointerException

Hibernate JIRA | Clint Popetz | 5 years ago
  1. 0

    For the following mapping: {code} public class AnEntity extends HibernatePersistedObject { @Id @GeneratedValue private Long id; @OneToOne(optional=false,mappedBy="anEntity") private TargetEntity target; } public class TargetEntity { @Id @GeneratedValue private Long id; @ManyToOne private AnEntity anEntity; } {code} and the following query: {code} AuditReaderFactory.get(em).createQuery(). forRevisionsOfEntity(AnEntity.class,false,false). add(AuditEntity.id().eq(id)).addOrder(AuditEntity.revisionNumber().desc()). setMaxResults(1).getSingleResult() {code} I get an NPE because the there is no EntityConfiguration for TargetEntity, as it is not audited: {noformat} java.lang.NullPointerException at org.hibernate.envers.query.impl.EntitiesAtRevisionQuery.list(EntitiesAtRevisionQuery.java:81) at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108) at org.hibernate.envers.entities.mapper.relation.OneToOneNotOwningMapper.mapToEntityFromMap(OneToOneNotOwningMapper.java:82) at org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:118) at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:100) at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:135) at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108) {noformat}

    Hibernate JIRA | 5 years ago | Clint Popetz
    java.lang.NullPointerException
  2. 0

    For the following mapping: {code} public class AnEntity extends HibernatePersistedObject { @Id @GeneratedValue private Long id; @OneToOne(optional=false,mappedBy="anEntity") private TargetEntity target; } public class TargetEntity { @Id @GeneratedValue private Long id; @ManyToOne private AnEntity anEntity; } {code} and the following query: {code} AuditReaderFactory.get(em).createQuery(). forRevisionsOfEntity(AnEntity.class,false,false). add(AuditEntity.id().eq(id)).addOrder(AuditEntity.revisionNumber().desc()). setMaxResults(1).getSingleResult() {code} I get an NPE because the there is no EntityConfiguration for TargetEntity, as it is not audited: {noformat} java.lang.NullPointerException at org.hibernate.envers.query.impl.EntitiesAtRevisionQuery.list(EntitiesAtRevisionQuery.java:81) at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108) at org.hibernate.envers.entities.mapper.relation.OneToOneNotOwningMapper.mapToEntityFromMap(OneToOneNotOwningMapper.java:82) at org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:118) at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:100) at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:135) at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108) {noformat}

    Hibernate JIRA | 5 years ago | Clint Popetz
    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.query.impl.EntitiesAtRevisionQuery.list()
    2. A Hibernate O/RM Module
      AbstractAuditQuery.getSingleResult
      1. org.hibernate.envers.query.impl.EntitiesAtRevisionQuery.list(EntitiesAtRevisionQuery.java:81)
      2. org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108)
      3. org.hibernate.envers.entities.mapper.relation.OneToOneNotOwningMapper.mapToEntityFromMap(OneToOneNotOwningMapper.java:82)
      4. org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:118)
      5. org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:100)
      6. org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:135)
      7. org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108)
      7 frames