在线急等答案~~!!~~郁闷中!!~~~
读取BB表中的数据,处理后,放入AA表中
sql语句:
insert
into
AA
(id,ad_code,ip_num,push_value,click_value,area_code,create_time,time_day,time_hour)select
sys_guid(),
t.ad_code,
t.ip_num,
t.push_value,
t.click_value,
t.area_code,
t.create_time,
to_char(t.create_time,
'yyyy-mm-dd'),
to_char(t.create_time,
'hh')
from
BB t
提交方式
Query query=this.getSession().createSQLQuery(sql);
query.executeUpdate();
测试插入:
public static void main(String []args){
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"/applicationContext-*.xml");
ExtractTimeDetailsJob a=(ExtractTimeDetailsJob) context.getBean("extractTimeDetailsJobService");
a.addwork();
}
事务处理是在service层,addwork()方法调用的是service层的方法,
调试时,打出的sql语句是正确的,程序里报错
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:198)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1191)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:357)
[zboss] INFO [main] atomikos.println(85) | afterCompletion ( STATUS_ROLLEDBACK ) called on Synchronization: org.hibernate.transaction.CacheSynchronization
[zboss] INFO [main] atomikos.println(85) | rollback() done of transaction tm0000100015
at com.izp.adwin.report.dao.impl.ExtractTimeDetailsDaoImp.insertToTimeDetails(ExtractTimeDetailsDaoImp.java:24)
at com.izp.adwin.report.job.ExtractTimeDetailsJob.addwork(ExtractTimeDetailsJob.java:26)
at com.izp.adwin.report.job.ExtractTimeDetailsJob$$FastClassByCGLIB$$8209904f.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
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.izp.adwin.report.job.ExtractTimeDetailsJob$$EnhancerByCGLIB$$3bf55216.addwork()
at com.izp.adwin.report.job.ExtractTimeDetailsJob$$FastClassByCGLIB$$8209904f.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
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.izp.adwin.report.job.ExtractTimeDetailsJob$$EnhancerByCGLIB$$ee5e74b5.addwork()
at com.izp.adwin.report.job.Test.main(Test.java:13)
Caused by: java.sql.SQLException: ORA-01722: invalid number
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:952)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:189)
... 21 more
疯了,急等答案!!~~~