spring mvc+hibernate jpa使用sqlserver 2000数据库修改数据报错!

用原生sql查询没有问题,修改的时候报错
javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:96)
at com.tyz.project.cook.dao.impl.MenuTaskDaoImpl.updTest(MenuTaskDaoImpl.java:49)
at com.tyz.project.cook.service.impl.MenuTaskServiceImpl.syncDak(MenuTaskServiceImpl.java:201)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy50.syncDak(Unknown Source)
at com.tyz.project.timetask.WebTask.TaskDakJob(WebTask.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

换mysql数据库就没有问题!!!

检查下事务配置
https://blog.csdn.net/lw_power/article/details/51296353

兄弟,你看下你的jar包,是否是关于Sqlserver的jar包(不能用MySQLjar包)。
com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc:sqlserver://localhost:端口;DatabaseName=数据库名字
还有或者注意一下你的
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">



com.microsoft.sqlserver.jdbc.SQLServerDriver





jdbc:sqlserver://IP:端口;database=数据库名字
;integratedSecurity=false





账号




密码



兄弟,你看下你的jar包,是否是关于Sqlserver的jar包(不能用MySQLjar包)。
com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc:sqlserver://localhost:端口;DatabaseName=数据库名字
还有或者注意一下你的

图片说明

J检查一下你的数据库驱动配置:
com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc:sqlserver://localhost:端口;DatabaseName=数据库名字