oracle 下hibernate 错误

(1):
建了一个表,指定id为主键,没有创建序列用的是native
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.job.domain.CzkVoteDm" table="CZK_VOTE_DM" schema="SYSTEM">
<id name="id" type="long">
<column name="ID" precision="22" scale="0" />
<generator class="native" />
</id>
<property name="sex" type="string">
<column name="SEX" length="20" />
</property>
<property name="campaigner" type="string">
<column name="CAMPAIGNER" length="20" />
</property>
<property name="votetime" type="date">
<column name="VOTETIME" length="7" />
</property>
</class>
</hibernate-mapping>
在进行增加的时候报错!发现是这个问题的,不知道过去是不是加了,反正我没有加
附在sql server中是指定表主键自增的种子

查询到解释的原因如下
好像Hibernate3默认为所有使用Sequence的ID项都关联一个名为'hibernate_sequence'的Sequence.
你只要在oracle中创建这个Sequence就行:
create sequence hibernate_sequence start with 1 increment by 1


(2):竟然忘记了更改dialect,汗
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>-->
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值