org.hibernate.HibernateException: createSQLQuery is not valid without active transaction

Spring JIRA | Björn Voß | 9 years ago
  1. 0

    If you use spring 2.5 as a drop in replacement @Transactional isn't working any more. They HibernateSession you get through a currentSession() has no active transaction and result in the following stack trace Exception in thread "main" org.hibernate.HibernateException: createSQLQuery is not valid without active transaction at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297) at $Proxy7.createSQLQuery(Unknown Source) at ag.pinguin.myservice.impl.MyService.doSomething(MyService.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy5.doSomething(Unknown Source) at test.SpringTestMain.main(SpringTestMain.java:16) With spring 2.0.7 the exact same code/config works fine

    Spring JIRA | 9 years ago | Björn Voß
    org.hibernate.HibernateException: createSQLQuery is not valid without active transaction
  2. 0

    If you use spring 2.5 as a drop in replacement @Transactional isn't working any more. They HibernateSession you get through a currentSession() has no active transaction and result in the following stack trace Exception in thread "main" org.hibernate.HibernateException: createSQLQuery is not valid without active transaction at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297) at $Proxy7.createSQLQuery(Unknown Source) at ag.pinguin.myservice.impl.MyService.doSomething(MyService.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy5.doSomething(Unknown Source) at test.SpringTestMain.main(SpringTestMain.java:16) With spring 2.0.7 the exact same code/config works fine

    Spring JIRA | 9 years ago | Björn Voß
    org.hibernate.HibernateException: createSQLQuery is not valid without active transaction
  3. 0

    org.hibernate.HibernateException: get is not valid without active transaction

    Stack Overflow | 5 years ago | VextoR
    org.hibernate.HibernateException: get is not valid without active transaction
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Java and Me: org.hibernate.HibernateException: createQuery is not valid without active transaction

    blogspot.com | 11 months ago
    org.hibernate.HibernateException: createQuery is not valid without active transaction
  6. 0

    Java and Me

    blogspot.com | 1 year ago
    org.hibernate.HibernateException: createQuery is not valid without active transaction

    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. org.hibernate.HibernateException

      createSQLQuery is not valid without active transaction

      at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke()
    2. Hibernate
      ThreadLocalSessionContext$TransactionProtectionWrapper.invoke
      1. org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
      1 frame
    3. Unknown
      $Proxy7.createSQLQuery
      1. $Proxy7.createSQLQuery(Unknown Source)
      1 frame
    4. ag.pinguin.myservice
      MyService.doSomething
      1. ag.pinguin.myservice.impl.MyService.doSomething(MyService.java:30)
      1 frame
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    6. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      3 frames
    7. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      1 frame
    8. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames
    9. Unknown
      $Proxy5.doSomething
      1. $Proxy5.doSomething(Unknown Source)
      1 frame
    10. test
      SpringTestMain.main
      1. test.SpringTestMain.main(SpringTestMain.java:16)
      1 frame