KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > proxy > LazyInitializer


1 //$Id: LazyInitializer.java,v 1.7 2005/06/20 20:32:35 oneovthafew Exp $
2
package org.hibernate.proxy;
3
4 import java.io.Serializable JavaDoc;
5
6 import org.hibernate.HibernateException;
7 import org.hibernate.engine.SessionImplementor;
8
9 /**
10  * Handles fetching of the underlying entity for a proxy
11  * @author Gavin King
12  */

13 public interface LazyInitializer {
14     
15     /**
16      * Initialize the proxy, fetching the target
17      * entity if necessary
18      */

19     public abstract void initialize() throws HibernateException;
20     
21     /**
22      * Get the identifier held by the proxy
23      */

24     public abstract Serializable JavaDoc getIdentifier();
25
26     /**
27      * Set the identifier property of the proxy
28      */

29     public abstract void setIdentifier(Serializable JavaDoc id);
30     
31     /**
32      * Get the entity name
33      */

34     public abstract String JavaDoc getEntityName();
35     
36     /**
37      * Get the actual class of the entity (don't
38      * use this, use the entityName)
39      */

40     public abstract Class JavaDoc getPersistentClass();
41     
42     /**
43      * Is the proxy uninitialzed?
44      */

45     public abstract boolean isUninitialized();
46     
47     /**
48      * Initialize the proxy manually
49      */

50     public abstract void setImplementation(Object JavaDoc target);
51     
52     /**
53      * Get the session, if this proxy is attached
54      */

55     public abstract SessionImplementor getSession();
56     
57     /**
58      * Attach the proxy to a session
59      */

60     public abstract void setSession(SessionImplementor s) throws HibernateException;
61
62     /**
63      * Return the underlying persistent object, initializing if necessary
64      */

65     public abstract Object JavaDoc getImplementation();
66
67     /**
68      * Return the underlying persistent object in the given <tt>Session</tt>, or null
69      */

70     public abstract Object JavaDoc getImplementation(SessionImplementor s)
71             throws HibernateException;
72     
73     public void setUnwrap(boolean unwrap);
74     public boolean isUnwrap();
75 }
Popular Tags