问题描述
插数据的时候报:Hibernate: select H_shop_ID.nextval from dualHibernate: insert into H_shop (shopname, town, password, chinaname, englishname, shopnum, address, phone, fax, email, contacter, mobile, website, description, picurl, status, createtime, updatetime, provinceid, cityid, shopTypeid, smallTypeid, advertise_url, shoppic1, shoppic2, shoppic3, shoppic4, count_ding, count_cai, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)2010-12-02 14:09:21 [org.hibernate.util.JDBCExceptionReporter]-[ERROR] ORA-02289: 序列不存在2010-12-02 14:09:21 [org.hibernate.event.def.AbstractFlushingEventListener]-[ERROR] Could not synchronize database state with session已经重置sequence,还是插入不了 问题补充:andy_javahome 写道
解决方案
你确定数据库创建了H_shop_ID吗,我把我数据库创建的sequence删了和你抱的错一样。
解决方案二:
把对应的列加上啊 <column name="ID" precision="10" scale="0" />
解决方案三:
在数据库里执行一个sequence create sequence user_seq increment by 1 start with 100000000 nomaxvalue nocycle nocache; <id name="id" type="java.lang.Long"> <column name="ID" precision="10" scale="0" /> <generator class="sequence" > <param name="sequence">user_seq</param> </generator> </id>你是这样做的吗。