spirng 自定义事务

通过cglib  做一份方法代理(做一些类反射,动态创建之类的事情)

完成指定方法的事务过滤

 

 

附贴一下报错信息:

--- Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'u_today_income' at row 52
 at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
 at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:457)
 at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
 at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.update(SqlMapClientImpl.java:66)
 at com.game.dao.impl.UserDaoImpl.income_call_proc(UserDaoImpl.java:270)
 at com.game.service.impl.UserManagerImpl.income_call_proc(UserManagerImpl.java:206)
 at com.socket.handler.CompanyHandler.myTask_12_operation(CompanyHandler.java:1070)
 at com.socket.handler.CompanyHandler$$FastClassByCGLIB$$d4ed247f.invoke(<generated>)
 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
 at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
 at com.socket.handler.CompanyHandler$$EnhancerByCGLIB$$f8255e56.myTask_12_operation(<generated>)
 at com.game.util.MyTask.run(MyTask.java:30)
 at java.util.TimerThread.mainLoop(Timer.java:512)
 at java.util.TimerThread.run(Timer.java:462)

 

 

 

 

就是做一份方法代理,判断一下执行的是什么方法,符合要求的,就加上方法前和方法后的处理

这个要看具体是实现了,你用spring的话倒也不用麻烦,反正都spring创建的对象都是经过代理动态生成的

你可能感兴趣的:(自定义)