Hibernate用Oracle的sequence生成自增Id

时间:2022-04-07 14:56:35
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    3. "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    4. <!--
    5. Mapping file autogenerated by MyEclipse Persistence Tools
    6. -->
    7. <hibernate-mapping>
    8. <class name="com.ko.pp.entity.InputUserInfo" table="Input_User_Info" schema="dbname">
    9. <id name="id" type="java.lang.Long">
    10. <column name="ID" precision="22" scale="0" />
    11. <generator class="sequence">
    12. <!--采用Oracle的Sequence机制-->
    13. <param name="sequence">INPUT_USER_INFO_SEQ</param>
    14. </generator>
    15. </id>
    16. <property name="name" type="string">
    17. <column name="NAME" length="20" />
    18. </property>
    19. <property name="certno" type="string">
    20. <column name="CERTNO" length="30" />
    21. </property>
    22. <property name="nationality" type="string">
    23. <column name="NATIONALITY" length="20" />
    24. </property>
    25. <property name="gender" type="string">
    26. <column name="GENDER" length="1" />
    27. </property>
    28. <property name="identity" type="string">
    29. <column name="IDENTITY" length="20" />
    30. </property>
    31. <property name="srvcls" type="string">
    32. <column name="SRVCLS" length="20" />
    33. </property>
    34. </class>
    35. </hibernate-mapping>