Hibernate连接oracle 执行插入时报错
oracle中创建了sequence
hbm.xml中也配置了
<id name="batchid" type="long">
<column name="batchid" precision="10" scale="0" />
<generator class="sequence">
<param name="sequence">practice_batch_seq</param>
</generator>
</id>
“practice_batch_seq”是序列名
反射生成的对象PracticeBatch
private long batchid;
private String batch;
private Date createtime;
private String creator;
private String creatorIp;
private Date starttime;
private Date endtime;
执行session.save(pbatch)时报错,
org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [insert into PRACTICE_BATCH (batch, createtime, creator, creator_ip, starttime, endtime, batchid) values (?, ?, ?, ?, ?, ?, ?)]; nested exception is
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
我并没有对batchid传值,batchid是主键,自增
这是什么问题,在网上查了很久,都没有解决,哪位大神能帮帮忙。
------最佳解决方案--------------------能有详细一点的异常信息吗?
------其他解决方案-------------------- +-[IDENT] IdentNode: '{synthetic-alias}'
------其他解决方案-------------------- \-[IDENT] IdentNode: 'endtime'
\-[DESCENDING] SqlNode: 'desc'
16:30:12,812 DEBUG ErrorCounter:91 - throwQueryException() : no errors
16:30:12,842 DEBUG QueryTranslatorImpl:241 - HQL: from po.PracticeBatch order by endtime desc
16:30:12,842 DEBUG QueryTranslatorImpl:242 - SQL: select practiceba0_.batchid as batchid0_, practiceba0_.batch as batch0_, practiceba0_.createtime as createtime0_, practiceba0_.creator as creator0_, practiceba0_.creator_ip as creator5_0_, practiceba0_.starttime as starttime0_, practiceba0_.endtime as endtime0_ from PRACTICE_BATCH practiceba0_ order by practiceba0_.endtime desc
16:30:12,843 DEBUG ErrorCounter:91 - throwQueryException() : no errors
16:30:12,856 DEBUG AbstractBatcher:410 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:30:12,856 DEBUG ConnectionManager:444 - opening JDBC connection
16:30:12,858 DEBUG SQL:111 - select practiceba0_.batchid as batchid0_, practiceba0_.batch as batch0_, practiceba0_.createtime as createtime0_, practiceba0_.creator as creator0_, practiceba0_.creator_ip as creator5_0_, practiceba0_.starttime as starttime0_, pra