布卡依 2010-10-20 17:26
浏览 3839
已采纳

hibernate 提交sql 报错 could not execute native bulk manipulation query

在线急等答案~~!!~~郁闷中!!~~~

读取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

疯了,急等答案!!~~~

  • 写回答

2条回答 默认 最新

  • enet_java 2010-10-20 17:33
    关注

    [quote]Caused by: java.sql.SQLException: ORA-01722: invalid number [/quote]

    两个表的字段类型是不是一致呀?

    看异常信息好像是入参不对哦。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 平板录音机录音问题解决
  • ¥15 请问维特智能的安卓APP在手机上存储传感器数据后,如何找到它的存储路径?
  • ¥15 (SQL语句|查询结果翻了4倍)
  • ¥15 Odoo17操作下面代码的模块时出现没有'读取'来访问
  • ¥50 .net core 并发调用接口问题
  • ¥15 网上各种方法试过了,pip还是无法使用
  • ¥15 用verilog实现tanh函数和softplus函数
  • ¥15 Hadoop集群部署启动Hadoop时碰到问题
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启