" />
您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> Java >> Hibernate连接oracle 执行插入时报错

Hibernate连接oracle 执行插入时报错

来源:网络整理     时间:2016/6/28 13:37:20     关键词:

关于网友提出的“ Hibernate连接oracle 执行插入时报错”问题疑问,本网通过在网上对“ Hibernate连接oracle 执行插入时报错”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: Hibernate连接oracle 执行插入时报错
描述:

oracle中创建了sequence
hbm.xml中也配置了

            
            
            practice_batch_seq
            
        
“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是主键,自增
这是什么问题,在网上查了很久,都没有解决,哪位大神能帮帮忙。


解决方案1:

我感觉一般在数据库中存储时间类型的话,的确不太好弄,把它设置成String的,并在插入的时候用Fomart转换下时间格式,存入数据库,取得时候方便,插入的时候也方便

解决方案2:

在对象中有没有对batchid字段进行注解呢???

解决方案3:

能有详细一点的异常信息吗?


以上介绍了“ Hibernate连接oracle 执行插入时报错”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2130304.html

相关图片

相关文章