java.lang.NullPointerException

Hibernate JIRA | Meytal | 1 year 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

    In our application we use EntityManager.Clear in a method annotated with @transactional although we know it's not best practice ( we'll remove the call to clear()). when performing the same operation in large scale (the operation is done on single element and not in a robust way), we get NullPointerException. stack trace: {code:java} java.lang.NullPointerException at org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:237) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.internalClear(SessionImpl.java:340) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.clear(SessionImpl.java:336) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.clear(AbstractEntityManagerImpl.java:1419) ~[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final] at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_60] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_60] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE] at com.sun.proxy.$Proxy79.clear(Unknown Source) ~[?:?] {code} the stack trace show that the the source of the call is our call to entityManager.clear().

    Hibernate JIRA | 1 year ago | Meytal
    java.lang.NullPointerException
  2. 0

    In our application we use EntityManager.Clear in a method annotated with @transactional although we know it's not best practice ( we'll remove the call to clear()). when performing the same operation in large scale (the operation is done on single element and not in a robust way), we get NullPointerException. stack trace: {code:java} java.lang.NullPointerException at org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:237) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.internalClear(SessionImpl.java:340) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.clear(SessionImpl.java:336) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.clear(AbstractEntityManagerImpl.java:1419) ~[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final] at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_60] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_60] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE] at com.sun.proxy.$Proxy79.clear(Unknown Source) ~[?:?] {code} the stack trace show that the the source of the call is our call to entityManager.clear().

    Hibernate JIRA | 1 year ago | Meytal
    java.lang.NullPointerException
  3. 0

    Spring @Transactional em.getDelegate sometimes return null

    Stack Overflow | 7 months ago | Leo
    java.lang.NullPointerException: null
  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.internal.StatefulPersistenceContext.clear()
    2. Hibernate
      SessionImpl.clear
      1. org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:237)[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
      2. org.hibernate.internal.SessionImpl.internalClear(SessionImpl.java:340)[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
      3. org.hibernate.internal.SessionImpl.clear(SessionImpl.java:336)[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
      3 frames
    3. org.hibernate.jpa
      AbstractEntityManagerImpl.clear
      1. org.hibernate.jpa.spi.AbstractEntityManagerImpl.clear(AbstractEntityManagerImpl.java:1419)[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final]
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)[?:?]
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[?:1.8.0_60]
      3. java.lang.reflect.Method.invoke(Method.java:497)[?:1.8.0_60]
      3 frames
    5. Spring ORM
      ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke
      1. org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344)[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
      1 frame
    6. com.sun.proxy
      $Proxy79.clear
      1. com.sun.proxy.$Proxy79.clear(Unknown Source)[?:?]
      1 frame