What is the generator in hibernate?
Hi Friends,
Hibernate Generator is used for primary key generation. It generate primary key when new record inserted.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping auto-import="true" default-lazy="true"> <class name="net.roseindia.model.EmployeeInfoModel" table="employeeinfo"> <id name="id" column="id" type="java.lang.Integer"> <generator class="increment" /> </id> <property name="name" column="name" type="java.lang.String" /> <property name="address" column="address" type="java.lang.String" /> </class> </hibernate-mapping>
Thanks.......
Ads