日期:2014-05-16 浏览次数:20498 次
<?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="sequence"></generator> </id> </class> </hibernate-mapping>
<?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>