Hibernate配置自动增长咧

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.example.entity">
    <class name="Foo">
       <id name="id"> 
            <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
                <!--初始值,默认是1-->
                <param name="initial_value">1000</param>
                <!--自增大小,默认是1-->
                <param name="increment_siz">1</param>
                <!--sequence的名字,默认是"hibernate_sequence"-->
                <param name="sequence_name">hibernate_sequence</param>
            </generator> 
        </id>   
    </class>
</hibernate-mapping>

你可能感兴趣的:(Hibernate)