org.hibernate.MappingException: Unknown entity: test.TestVO

Spring JIRA | Dmitri | 1 decade ago
  1. 0

    Calls to hibernate Session methods fail after a rollback has occured. In the following code the last statement will throw org.hibernate.MappingException: Unknown entity: test.TestVO. [code] Session session = this.sessionFactory.getCurrentSession(); TestVO testVO = (TestVO)session.load("test", new Long(1)); try { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.execute (new TransactionCallbackWithoutResult() { public void doInTransactionWithoutResult(TransactionStatus status) { // some logic here throw new RuntimeException("Some kind of runtime exception"); }}); } finally { session.lock(testVO, LockMode.NONE); // throws org.hibernate.MappingException } [/code] The same thing happens in case of declarative transaction demarcation. (In both cases if no exception thrown, transaction commits and the session is okay.) I've set up a small test application: test.xml: [code] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="testDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/DorsCoreDS"/> <property name="proxyInterface" value="javax.sql.DataSource"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="testDataSource"/> <property name="mappingResources"> <list> <value>Test.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="serviceTarget" class="test.ServiceImpl"> <property name="transactionManager" ref="txManager"/> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="service" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target" ref="serviceTarget"/> <property name="proxyInterfaces" value="test.Service"/> <property name="interceptorNames"> <list> <value>hibernateInterceptor</value> </list> </property> </bean> </beans> [/code] Test.hbm.xml: [code] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class entity-name="test" name="test.TestVO" table="TEST_TABLE" dynamic-update="true" rowid="rowid" optimistic-lock="version"> <id name="id" type="long" column="ID" unsaved-value="null"> <generator class="sequence"> <param name="sequence">test_seq</param> </generator> </id> <version name="ts" type="timestamp" column="TS" unsaved-value="null"/> <property name="text" column="TEXT" type="string"/> </class> </hibernate-mapping> [/code] Service.java: [code] package test; public interface Service { void doSmth(); } [/code] ServiceImpl.java: [code] package test; import org.hibernate.SessionFactory; import org.hibernate.Session; import org.hibernate.LockMode; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionCallbackWithoutResult; public class ServiceImpl implements Service { private PlatformTransactionManager transactionManager; public void setTransactionManager(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public void doSmth() { final Session session = this.sessionFactory.getCurrentSession(); final TestVO testVO = (TestVO)session.load("test", new Long(1)); session.lock(testVO, LockMode.NONE); System.out.println("-----------> The first session.lock() is okay"); try { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.execute (new TransactionCallbackWithoutResult() { public void doInTransactionWithoutResult(TransactionStatus status) { session.lock(testVO, LockMode.NONE); System.out.println("-----------> The second session.lock() is okay"); throw new RuntimeException("Some kind of runtime exception inside the transaction"); } }); } finally { System.out.println("-----------> Just before the third session.lock()..."); try { session.lock(testVO, LockMode.NONE); System.out.println("-----------> The third session.lock() is okay"); // this statement won't get executed } catch (RuntimeException re) { System.out.println("-----------> The third session.lock() failed with the following exception:"); re.printStackTrace(); } } } } [/code] log4.properties: [code] log4j.rootLogger=INFO, stdout log4j.logger.org.hibernate.SQL=DEBUG log4j.logger.org.hibernate.transaction=DEBUG log4j.logger.org.springframework.transaction=DEBUG log4j.logger.org.springframework.orm=DEBUG [/code] output log: [code] 17:29:47,718 INFO HibernateTransactionManager:396 - Using DataSource [jdbc:oracle:thin:@192.168.0.1:1521:SID] of Hibernate SessionFactory for HibernateTransactionManager 17:29:47,734 INFO ContextLoader:189 - Using context class [org.springframework.web.context.support.XmlWebApplicationContext] for root WebApplicationContext 17:29:47,734 INFO ContextLoader:199 - Root WebApplicationContext: initialization completed in 1219 ms 17:29:56,109 DEBUG SessionFactoryUtils:329 - Opening Hibernate Session 17:29:56,109 DEBUG TransactionSynchronizationManager:162 - Bound value [org.springframework.orm.hibernate3.SessionHolder@1fb24d3] for key [org.hibernate.impl.SessionFactoryImpl@12ea1dd] to thread [HttpRequestHandler-14518777] 17:29:56,109 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@1fb24d3] for key [org.hibernate.impl.SessionFactoryImpl@12ea1dd] bound to thread [HttpRequestHandler-14518777] 17:29:56,171 DEBUG SQL:346 - select test0_.ID as ID6_0_, test0_.TS as TS6_0_, test0_.TEXT as TEXT6_0_, test0_.rowid as rowid_0_ from TEST_TABLE test0_ where test0_.ID=? 06/03/25 17:29:56 -----------> The first session.lock() is okay 17:29:56,187 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@1fb24d3] for key [org.hibernate.impl.SessionFactoryImpl@12ea1dd] bound to thread [HttpRequestHandler-14518777] 17:29:56,187 DEBUG HibernateTransactionManager:413 - Found thread-bound Session [org.hibernate.impl.SessionImpl@725967] for Hibernate transaction 17:29:56,187 DEBUG HibernateTransactionManager:254 - Using transaction object [org.springframework.orm.hibernate3.HibernateTransactionManager$HibernateTransactionObject@14ba9a2] 17:29:56,187 DEBUG HibernateTransactionManager:281 - Creating new transaction with name [null] 17:29:56,187 DEBUG HibernateTransactionManager:462 - Preparing JDBC Connection of Hibernate Session [org.hibernate.impl.SessionImpl@725967] 17:29:56,187 DEBUG JDBCTransaction:54 - begin 17:29:56,187 DEBUG JDBCTransaction:59 - current autocommit status: true 17:29:56,187 DEBUG JDBCTransaction:62 - disabling autocommit 17:29:56,187 DEBUG HibernateTransactionManager:534 - Exposing Hibernate transaction as JDBC transaction [oracle.jdbc.driver.T4CConnection@6dddcf] 17:29:56,187 DEBUG TransactionSynchronizationManager:162 - Bound value [org.springframework.jdbc.datasource.ConnectionHolder@fd4662] for key [jdbc:oracle:thin:@192.168.0.1:1521:SID] to thread [HttpRequestHandler-14518777] 17:29:56,187 DEBUG TransactionSynchronizationManager:214 - Initializing transaction synchronization 06/03/25 17:29:56 -----------> The second session.lock() is okay 17:29:56,203 DEBUG TransactionTemplate:137 - Initiating transaction rollback on application exception java.lang.RuntimeException: Some kind of runtime exception inside the transaction at test.ServiceImpl$1.doInTransactionWithoutResult(ServiceImpl.java:49) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114) at test.ServiceImpl.doSmth(ServiceImpl.java:42) 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:287) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176) at $Proxy10.doSmth(Unknown Source) at test.TestServlet.service(TestServlet.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ................... 17:29:56,203 DEBUG HibernateTransactionManager:673 - Triggering beforeCompletion synchronization 17:29:56,203 DEBUG HibernateTransactionManager:581 - Initiating transaction rollback 17:29:56,203 DEBUG HibernateTransactionManager:599 - Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@725967] 17:29:56,203 DEBUG JDBCTransaction:152 - rollback 17:29:56,203 DEBUG JDBCTransaction:193 - re-enabling autocommit 17:29:56,203 DEBUG JDBCTransaction:163 - rolled back JDBC Connection 17:29:56,203 DEBUG HibernateTransactionManager:697 - Triggering afterCompletion synchronization 17:29:56,203 DEBUG TransactionSynchronizationManager:265 - Clearing transaction synchronization 17:29:56,203 DEBUG TransactionSynchronizationManager:185 - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@fd4662] for key [jdbc:oracle:thin:@192.168.0.1:1521:SID] from thread [HttpRequestHandler-14518777] 17:29:56,203 DEBUG HibernateTransactionManager:666 - Not closing pre-bound Hibernate Session [org.hibernate.impl.SessionImpl@725967] after transaction 06/03/25 17:29:56 -----------> Just before the third session.lock()... 06/03/25 17:29:56 -----------> The third session.lock() failed with the following exception: org.hibernate.MappingException: Unknown entity: test.TestVO at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:513) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1321) at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:50) at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:608) at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:600) at test.ServiceImpl.doSmth(ServiceImpl.java:59) 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:287) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176) at $Proxy10.doSmth(Unknown Source) at test.TestServlet.service(TestServlet.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ................... [/code]

    Spring JIRA | 1 decade ago | Dmitri
    org.hibernate.MappingException: Unknown entity: test.TestVO
  2. 0

    Calls to hibernate Session methods fail after a rollback has occured. In the following code the last statement will throw org.hibernate.MappingException: Unknown entity: test.TestVO. [code] Session session = this.sessionFactory.getCurrentSession(); TestVO testVO = (TestVO)session.load("test", new Long(1)); try { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.execute (new TransactionCallbackWithoutResult() { public void doInTransactionWithoutResult(TransactionStatus status) { // some logic here throw new RuntimeException("Some kind of runtime exception"); }}); } finally { session.lock(testVO, LockMode.NONE); // throws org.hibernate.MappingException } [/code] The same thing happens in case of declarative transaction demarcation. (In both cases if no exception thrown, transaction commits and the session is okay.) I've set up a small test application: test.xml: [code] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="testDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/DorsCoreDS"/> <property name="proxyInterface" value="javax.sql.DataSource"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="testDataSource"/> <property name="mappingResources"> <list> <value>Test.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="serviceTarget" class="test.ServiceImpl"> <property name="transactionManager" ref="txManager"/> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="service" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target" ref="serviceTarget"/> <property name="proxyInterfaces" value="test.Service"/> <property name="interceptorNames"> <list> <value>hibernateInterceptor</value> </list> </property> </bean> </beans> [/code] Test.hbm.xml: [code] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class entity-name="test" name="test.TestVO" table="TEST_TABLE" dynamic-update="true" rowid="rowid" optimistic-lock="version"> <id name="id" type="long" column="ID" unsaved-value="null"> <generator class="sequence"> <param name="sequence">test_seq</param> </generator> </id> <version name="ts" type="timestamp" column="TS" unsaved-value="null"/> <property name="text" column="TEXT" type="string"/> </class> </hibernate-mapping> [/code] Service.java: [code] package test; public interface Service { void doSmth(); } [/code] ServiceImpl.java: [code] package test; import org.hibernate.SessionFactory; import org.hibernate.Session; import org.hibernate.LockMode; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionCallbackWithoutResult; public class ServiceImpl implements Service { private PlatformTransactionManager transactionManager; public void setTransactionManager(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public void doSmth() { final Session session = this.sessionFactory.getCurrentSession(); final TestVO testVO = (TestVO)session.load("test", new Long(1)); session.lock(testVO, LockMode.NONE); System.out.println("-----------> The first session.lock() is okay"); try { TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager); transactionTemplate.execute (new TransactionCallbackWithoutResult() { public void doInTransactionWithoutResult(TransactionStatus status) { session.lock(testVO, LockMode.NONE); System.out.println("-----------> The second session.lock() is okay"); throw new RuntimeException("Some kind of runtime exception inside the transaction"); } }); } finally { System.out.println("-----------> Just before the third session.lock()..."); try { session.lock(testVO, LockMode.NONE); System.out.println("-----------> The third session.lock() is okay"); // this statement won't get executed } catch (RuntimeException re) { System.out.println("-----------> The third session.lock() failed with the following exception:"); re.printStackTrace(); } } } } [/code] log4.properties: [code] log4j.rootLogger=INFO, stdout log4j.logger.org.hibernate.SQL=DEBUG log4j.logger.org.hibernate.transaction=DEBUG log4j.logger.org.springframework.transaction=DEBUG log4j.logger.org.springframework.orm=DEBUG [/code] output log: [code] 17:29:47,718 INFO HibernateTransactionManager:396 - Using DataSource [jdbc:oracle:thin:@192.168.0.1:1521:SID] of Hibernate SessionFactory for HibernateTransactionManager 17:29:47,734 INFO ContextLoader:189 - Using context class [org.springframework.web.context.support.XmlWebApplicationContext] for root WebApplicationContext 17:29:47,734 INFO ContextLoader:199 - Root WebApplicationContext: initialization completed in 1219 ms 17:29:56,109 DEBUG SessionFactoryUtils:329 - Opening Hibernate Session 17:29:56,109 DEBUG TransactionSynchronizationManager:162 - Bound value [org.springframework.orm.hibernate3.SessionHolder@1fb24d3] for key [org.hibernate.impl.SessionFactoryImpl@12ea1dd] to thread [HttpRequestHandler-14518777] 17:29:56,109 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@1fb24d3] for key [org.hibernate.impl.SessionFactoryImpl@12ea1dd] bound to thread [HttpRequestHandler-14518777] 17:29:56,171 DEBUG SQL:346 - select test0_.ID as ID6_0_, test0_.TS as TS6_0_, test0_.TEXT as TEXT6_0_, test0_.rowid as rowid_0_ from TEST_TABLE test0_ where test0_.ID=? 06/03/25 17:29:56 -----------> The first session.lock() is okay 17:29:56,187 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@1fb24d3] for key [org.hibernate.impl.SessionFactoryImpl@12ea1dd] bound to thread [HttpRequestHandler-14518777] 17:29:56,187 DEBUG HibernateTransactionManager:413 - Found thread-bound Session [org.hibernate.impl.SessionImpl@725967] for Hibernate transaction 17:29:56,187 DEBUG HibernateTransactionManager:254 - Using transaction object [org.springframework.orm.hibernate3.HibernateTransactionManager$HibernateTransactionObject@14ba9a2] 17:29:56,187 DEBUG HibernateTransactionManager:281 - Creating new transaction with name [null] 17:29:56,187 DEBUG HibernateTransactionManager:462 - Preparing JDBC Connection of Hibernate Session [org.hibernate.impl.SessionImpl@725967] 17:29:56,187 DEBUG JDBCTransaction:54 - begin 17:29:56,187 DEBUG JDBCTransaction:59 - current autocommit status: true 17:29:56,187 DEBUG JDBCTransaction:62 - disabling autocommit 17:29:56,187 DEBUG HibernateTransactionManager:534 - Exposing Hibernate transaction as JDBC transaction [oracle.jdbc.driver.T4CConnection@6dddcf] 17:29:56,187 DEBUG TransactionSynchronizationManager:162 - Bound value [org.springframework.jdbc.datasource.ConnectionHolder@fd4662] for key [jdbc:oracle:thin:@192.168.0.1:1521:SID] to thread [HttpRequestHandler-14518777] 17:29:56,187 DEBUG TransactionSynchronizationManager:214 - Initializing transaction synchronization 06/03/25 17:29:56 -----------> The second session.lock() is okay 17:29:56,203 DEBUG TransactionTemplate:137 - Initiating transaction rollback on application exception java.lang.RuntimeException: Some kind of runtime exception inside the transaction at test.ServiceImpl$1.doInTransactionWithoutResult(ServiceImpl.java:49) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114) at test.ServiceImpl.doSmth(ServiceImpl.java:42) 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:287) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176) at $Proxy10.doSmth(Unknown Source) at test.TestServlet.service(TestServlet.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ................... 17:29:56,203 DEBUG HibernateTransactionManager:673 - Triggering beforeCompletion synchronization 17:29:56,203 DEBUG HibernateTransactionManager:581 - Initiating transaction rollback 17:29:56,203 DEBUG HibernateTransactionManager:599 - Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@725967] 17:29:56,203 DEBUG JDBCTransaction:152 - rollback 17:29:56,203 DEBUG JDBCTransaction:193 - re-enabling autocommit 17:29:56,203 DEBUG JDBCTransaction:163 - rolled back JDBC Connection 17:29:56,203 DEBUG HibernateTransactionManager:697 - Triggering afterCompletion synchronization 17:29:56,203 DEBUG TransactionSynchronizationManager:265 - Clearing transaction synchronization 17:29:56,203 DEBUG TransactionSynchronizationManager:185 - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@fd4662] for key [jdbc:oracle:thin:@192.168.0.1:1521:SID] from thread [HttpRequestHandler-14518777] 17:29:56,203 DEBUG HibernateTransactionManager:666 - Not closing pre-bound Hibernate Session [org.hibernate.impl.SessionImpl@725967] after transaction 06/03/25 17:29:56 -----------> Just before the third session.lock()... 06/03/25 17:29:56 -----------> The third session.lock() failed with the following exception: org.hibernate.MappingException: Unknown entity: test.TestVO at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:513) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1321) at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:50) at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:608) at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:600) at test.ServiceImpl.doSmth(ServiceImpl.java:59) 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:287) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176) at $Proxy10.doSmth(Unknown Source) at test.TestServlet.service(TestServlet.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ................... [/code]

    Spring JIRA | 1 decade ago | Dmitri
    org.hibernate.MappingException: Unknown entity: test.TestVO
  3. 0

    GPMONGODB-44: Unique constraint related to a *..1 association doesn't work

    GitHub | 6 years ago | graemerocher
    org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.doc4web.xfast.domain.dynamic.DocumentModel; nested exception is org.hibernate.MappingException: Unknown entity: com.doc4web.xfast.domain.dynamic.DocumentModel
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.hibernate.MappingException: Unknown entity when trying to save POJO

    Stack Overflow | 2 years ago | user3831696
    org.hibernate.MappingException: Unknown entity: org.aggu.sramam.pojo.SramaSangham
  6. 0

    Using HbEntityDataStore causes org.hibernate.MappingException: Unknown entity:...

    Eclipse Bugzilla | 6 years ago | flavio.donze
    javax.persistence.PersistenceException: Unable to build EntityManagerFactory

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

      Unknown entity: test.TestVO

      at org.hibernate.impl.SessionFactoryImpl.getEntityPersister()
    2. Hibernate
      SessionImpl.lock
      1. org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:513)
      2. org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1321)
      3. org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:50)
      4. org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:608)
      5. org.hibernate.impl.SessionImpl.lock(SessionImpl.java:600)
      5 frames
    3. test
      ServiceImpl.doSmth
      1. test.ServiceImpl.doSmth(ServiceImpl.java:59)
      1 frame
    4. 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
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
      3 frames
    6. Hibernate
      HibernateInterceptor.invoke
      1. org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97)
      1 frame
    7. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
      2 frames
    8. Unknown
      $Proxy10.doSmth
      1. $Proxy10.doSmth(Unknown Source)
      1 frame
    9. test
      TestServlet.service
      1. test.TestServlet.service(TestServlet.java:38)
      1 frame
    10. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      1 frame