Hibernate用Oracle的sequence生成自增Id

<?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 Persistence Tools
-->
<hibernate-mapping>
    <class name="com.ko.pp.entity.InputUserInfo" table="Input_User_Info" schema="dbname">
        <id name="id" type="java.lang.Long">
            <column name="ID" precision="22" scale="0" />
            <generator class="sequence">
            	<!--采用Oracle的Sequence机制-->
			<param name="sequence">INPUT_USER_INFO_SEQ</param>
	    </generator> 
        </id>
        <property name="name" type="string">
            <column name="NAME" length="20" />
        </property>
        <property name="certno" type="string">
            <column name="CERTNO" length="30" />
        </property>
        <property name="nationality" type="string">
            <column name="NATIONALITY" length="20" />
        </property>
        <property name="gender" type="string">
            <column name="GENDER" length="1" />
        </property>
        <property name="identity" type="string">
            <column name="IDENTITY" length="20" />
        </property>
        <property name="srvcls" type="string">
            <column name="SRVCLS" length="20" />
        </property>
    </class>
</hibernate-mapping>
 

没有更多推荐了,返回首页