KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > id > IdentityGenerator


1 //$Id: IdentityGenerator.java,v 1.7 2005/03/17 21:09:13 oneovthafew Exp $
2
package org.hibernate.id;
3
4 import java.io.Serializable JavaDoc;
5 import java.sql.ResultSet JavaDoc;
6 import java.sql.SQLException JavaDoc;
7
8 import org.hibernate.engine.SessionImplementor;
9
10
11 /**
12  * The IdentityGenerator for autoincrement/identity key generation.
13  * <br><br>
14  * Indicates to the <tt>Session</tt> that identity (ie. identity/autoincrement
15  * column) key generation should be used.
16  *
17  * @author Christoph Sturm
18  */

19 public class IdentityGenerator extends AbstractPostInsertGenerator {
20
21     protected String JavaDoc getSQL(PostInsertIdentityPersister persister) {
22         return persister.getIdentitySelectString();
23     }
24     
25     protected Serializable JavaDoc getResult(SessionImplementor session, ResultSet JavaDoc rs, Object JavaDoc object, PostInsertIdentityPersister persister)
26     throws SQLException JavaDoc {
27         return IdentifierGeneratorFactory.getGeneratedIdentity( rs, persister.getIdentifierType() );
28     }
29 }
30
31
32
33
34
35
36
Popular Tags