KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: IdentifierGenerator.java,v 1.7 2005/02/12 07:19:22 steveebersole Exp $
2
package org.hibernate.id;
3
4 import org.hibernate.HibernateException;
5 import org.hibernate.engine.SessionImplementor;
6
7 import java.io.Serializable JavaDoc;
8
9 /**
10  * The general contract between a class that generates unique
11  * identifiers and the <tt>Session</tt>. It is not intended that
12  * this interface ever be exposed to the application. It <b>is</b>
13  * intended that users implement this interface to provide
14  * custom identifier generation strategies.<br>
15  * <br>
16  * Implementors should provide a public default constructor.<br>
17  * <br>
18  * Implementations that accept configuration parameters should
19  * also implement <tt>Configurable</tt>.
20  * <br>
21  * Implementors <em>must</em> be threadsafe
22  *
23  * @author Gavin King
24  * @see PersistentIdentifierGenerator
25  * @see Configurable
26  */

27 public interface IdentifierGenerator {
28
29     /**
30      * The configuration parameter holding the entity name
31      */

32     public static final String JavaDoc ENTITY_NAME = "entity_name";
33     
34     /**
35      * Generate a new identifier.
36      * @param session
37      * @param object the entity or toplevel collection for which the id is being generated
38      *
39      * @return a new identifier
40      * @throws HibernateException
41      */

42     public Serializable JavaDoc generate(SessionImplementor session, Object JavaDoc object)
43     throws HibernateException;
44
45 }
46
Popular Tags