Я работаю над сборкой продукта весной 3 и hibernate 3, я обновил этот hibernate 5 и Spring 5. Теперь я могу развернуть приложение, но когда я пытаюсь соединиться с базой данных, то получаю это "javax.persistence .TransactionRequiredException: транзакция не выполняется "
<bean id="sessionFactoryBean"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSourceBean" />
<property name="annotatedClasses">
<!-- The model class is incorporated here -->
<list>
<value>com.test.ab.base.AaUser</value>
<value>com.test.ab.dealer.AaDealer</value>
<list>
<bean id="txManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactoryBean" />
</bean>
И это мой слой Дао:
public class DatabaseConnection extends HibernateDaoSupport {
public DatabaseConnection (){
}
public static String QUERY_PREFIX_COUNT = "SELECT COUNT(*) ";
protected void applyNamedParameterToQuery(Query queryObject, String paramName, Object value)
throws HibernateException {
if (value instanceof Collection) {
queryObject.setParameterList(paramName, (Collection) value);
}
else if (value instanceof Object[]) {
queryObject.setParameterList(paramName, (Object[]) value);
}
else {
queryObject.setParameter(paramName, value);
}
}
protected String save(Object obj) throws HibernateException {
return getHibernateTemplate().save(obj).toString();
}
protected void update(Object obj) throws HibernateException {
getHibernateTemplate().update(obj);
}
//this is to be used to attached the detached object in session...
protected void merge(Object obj) throws HibernateException {
getHibernateTemplate().merge(obj);
}
protected void saveOrUpdObj(Object obj) throws HibernateException {
getHibernateTemplate().saveOrUpdate(obj);
}
}
javax .persistence.TransactionRequiredException: ни одна транзакция не выполняется в org.hibernate.internal.AbstractSharedSessionContract.checkTransactionNeededForUpdateOperation (AbstractSharedSessionContract. java: 398) в org.hibernate.internal.SessionImpl.eperation.ImpIessionSession.mpI .hibernate.internal.SessionImpl.doFlu sh (SessionImpl. java: 1462) в org.hibernate.internal.SessionImpl.flu sh (SessionImpl. java: 1458) в org.springframework.orm.hibernate5 .SessionFactoryUtils.flu sh (SessionFactoryUtils. java: 148) в org.springframework.orm.hibernate5.Spring SessionSynchronization.beforeCommit (SpringSessionSynchronization. java: 95) в org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit (TransactionSynchronizationUtils. java: 96) в org.springfraactionanTMBTMBTMBTMBTBTMBTBTMBT.RuTMBTMBT.PhBTMBR. *: 919. .transaction. (TransactionIntercep tor. java: 118) в org.springframework.aop.framework. в com.sun.proxy. $ Proxy89.getAllAbModuleUserMapping (неизвестный источник) в com.actionbean.ab.base.WelcomeActionManager.fillModules (WelcomeActionManager. java: 249) в com.actionbean.ab.base.WelcomeActionManager.createManager.createUs ( . java: 211) в com.actionbean.ab.base.WelcomeActionManager.retrieveSessionUserDataInternal (WelcomeActionManager. java: 83) в com.actionbean.ab.base.WelcomeActionManager.retrieveSessionUserData (WelcomeActionManager. * 61 *): com.actionbean.ab.base.WelcomeAction.performExecute (WelcomeAction. java: 47) в com.actionbean.ab.base.BaseAction.execute (BaseAction. java: 153) в org. apache .struts. action.RequestProcessor.processActionPerform (RequestProcessor. java: 425) в орг. apache .struts.action.RequestProcessor.process (RequestProc essor. java: 228) в орг. apache .struts.action.ActionServlet.process (ActionServlet. java: 1913) в орг. apache .struts.action.ActionServlet.doPost (ActionServlet. * 1044) *: 462) в javax.servlet.http.HttpServlet.service (HttpServlet. java: 647) в javax.servlet.http.HttpServlet.service (HttpServlet. java: 728) в орг. apache .catina .core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 303) в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 208) в com.actionbean.ab.filterB (AbFilter. java: 51) в орг. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 241) в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilter (ApplicationFilter). 1055 *: 208) в орг. apache .tomcat.websocket.server.WsFilter.doFilter (WsFilter. java: 52) в орг. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 241) в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain * java: 208) на 208) 1062 * .catalina.core.StandardWrapperValve.invoke (StandardWrapperValve. java: 219) в org. apache .catalina.core.StandardContextValve.invoke (StandardContextValve. java: 110) в org. * 1066. .authenticator.AuthenticatorBase.invoke (AuthenticatorBase. java: 444) в орг. apache .catalina.core.StandardHostValve.invoke (StandardHostValve. java: 169) в орг. apache .catalina.valve.Eror .invoke (ErrorReportValve. java: 104) в орг. apache .catalina.valves.AccessLogValve.invoke (AccessLogValve. java: 1025) в орг. apache .catalina.core.StandardEngineValve.invoke (StandardE . java: 116) в орг. apache .catalina.connector.CoyoteAdapter.service (CoyoteAdapter. java: 445) в орг. apache .coyote.http11.AbstractHttp11Processor.process (AbstractHttp11Processor. java : 1137) в орг. apache. Койот. AbstractProtocol $ AbstractConnectionHandler.process (AbstractProtocol. java: 637) в орг. apache .tomcat.util. net .JIoEndpoint $ SocketProcessor.run (JIoEndpoint. java: 319) в java .util. concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor. java: 1149) в java .util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor. java: 624) в орг. apache .tomcat.util. TaskThread $ WrappingRunnable.run (TaskThread. java: 61) в java .lang.Thread.run (Thread. java: 748) javax.persistence.TransactionRequiredException: в org.hibernate.internal транзакция не выполняется. С *: 1462) в org.hibernate.internal.SessionImpl.flu sh (SessionImpl. java: 1458) в org.springframework.orm.hibernate5.SessionFactoryUti ls.flu sh (SessionFactoryUtils. java: 148) по адресу org.springframework.orm.hibernate5.SpringSessionSynchronization.beforeCommit (SpringSessionSynchronization. java: 95) по адресу org.springframework.transaction.supportynchronizationUU . java: 96) в org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit (AbstractPlatformTransactionManager. java: 919) в org.springframework.transaction.support.AbstractPmart org.springframework.transaction.support.AbstractPlatformTransactionManager.commit (AbstractPlatformTransactionManager. java: 711) в org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning TransactionAspectSupport.invokeWithinTransaction (TransactionAspectSupport. java: 385) в орг. springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor. java: 118) в org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.opra. invoke (JdkDynamicAopProxy. java: 212) в com.sun.proxy. $ Proxy89.getAllAbModuleUserMapping (Неизвестный источник) в com.actionbean.ab.base.WelcomeActionManager.fillModules (WelcomeActionManager. java: 249) в com. .ab. (WelcomeActionManager. java: 61) на com.actionbean.ab.base.WelcomeAction. executeExecute (WelcomeAction. java: 47) в com.actionbean.ab.base.BaseAction.execute (BaseAction. java: 153) в org. apache .struts.action.RequestProcessor.processActionPerform (RequestProcessor. java: 425) в орг. apache .struts.action.RequestProcessor.process (RequestProcessor. java: 228) в орг. apache .struts.action.ActionServlet.process (ActionServlet. java: 1913) в орг. apache .struts.action.ActionServlet.doPost (ActionServlet. java: 462) в javax.servlet.http.HttpServlet.service (HttpServlet. java: 647) в javax.servlet.http.HttpServ .service (HttpServlet. java: 728) в орг. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 303) в орг. apache .catalina.core.ApplicationFilterChaindo. . java: 208) в com.actionbean.ab.filter.AbFilter.doFilter (AbFilter. java: 51) в орг. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 241 ) в орг. apache .catalina.core.ApplicationFilterChain.doFilter (Appl icationFilterChain. java: 208) в орг. apache .tomcat.websocket.server.WsFilter.doFilter (WsFilter. java: 52) в орг. apache .catalina.core.ApplicationFilterChain.internalDoFilter. java: 241) в орг. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 208) в орг. apache .catalina.core.StandardWrapperValve.invoke (StandardWrapperValve. * 1143) 219) в орг. apache .catalina.core.StandardContextValve.invoke (StandardContextValve. java: 110) в орг. apache .catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase. java: 444) в или . apache .catalina.core.StandardHostValve.invoke (StandardHostValve. java: 169) в орг. apache .catalina.valves.ErrorReportValve.invoke (ErrorReportValve. java: 104) в орг. apache .catalina.valves.AccessLogValve.invoke (AccessLogValve. java: 1025) в орг. apache .catalina.core.StandardEngineValve.invoke (StandardEngineValve. java: 116) в орг. apache .catalina.connector .CoyoteAdapter.service (CoyoteAdapter. java: 445) в орг. * 115 8 * .coyote.http11.AbstractHttp11Processor.process (AbstractHttp11Processor. java: 1137) в org. apache .coyote.AbstractProtocol $ AbstractConnectionHandler.process (AbstractProtocol. java: 637) в орг. apache .om. .util. net .JIoEndpoint $ SocketProcessor.run (JIoEndpoint. java: 319) в java .util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor. java: 1149) в java .util.con .ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor. java: 624) в орг. apache .tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread. java: 61) в java .lang.Thread .run (. тема java: 748)