读书人

hibernate+oracle报错(could not get

发布时间: 2012-05-22 18:18:54 作者: rapoo

hibernate+oracle报错(could not get next sequence value)
select reportbill.nextval from dual
......................

org.hibernate.exception.GenericJDBCException: could not get next sequence value;
。。。。。。。。。。
Caused by: java.sql.SQLException: ORA-02289: 序列不存在



session.save(report);
commit();


报上述错误,

hibernate映射配置如下:


<class name="com.test.model.reportbill.ReportBill" table="REPORT_BILL" schema="test" lazy="false">
<id name="rid" type="java.lang.Long">
<column name="RID" precision="22" scale="0" />
<generator class="sequence"><param name="sequence">reportbill</param></generator>
</id>
<many-to-one name="user" class="com.sundan.model.ura.SysUser" fetch="select">
<column name="USERID" length="36" />
</many-to-one>
<many-to-one name="sla" class="com.sundan.model.reportbill.Sla" fetch="select" lazy="false">
<column name="SID" length="10" />
</many-to-one>


。。。。。。。。。。。。。。。。

</class>

将配置文件RID的generator属性删掉,通过setXXX()赋值,运行正常!!



请高手指教!!




[解决办法]
会不会是你的reportbill这个sequence在数据库没有创建啊???

读书人网 >J2EE开发

热点推荐