LazyInitializer.java in  » Database-ORM » hibernate » org » hibernate » proxy » Java Source Code / Java Documentation Java Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Natural Language Processing
51.Net
52.Parser
53.PDF
54.Portal
55.Profiler
56.Project Management
57.Report
58.RSS RDF
59.Rule Engine
60.Science
61.Scripting
62.Search Engine
63.Security
64.Sevlet Container
65.Source Control
66.Swing Library
67.Template Engine
68.Test Coverage
69.Testing
70.UML
71.Web Crawler
72.Web Framework
73.Web Mail
74.Web Server
75.Web Services
76.Web Services apache cxf 2.2.6
77.Web Services AXIS2
78.Wiki Engine
79.Workflow Engines
80.XML
81.XML UI
Java Source Code / Java Documentation  » Database ORM » hibernate » org.hibernate.proxy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


        /*
         * Hibernate, Relational Persistence for Idiomatic Java
         *
         * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
         * indicated by the @author tags or express copyright attribution
         * statements applied by the authors.  All third-party contributions are
         * distributed under license by Red Hat Middleware LLC.
         *
         * This copyrighted material is made available to anyone wishing to use, modify,
         * copy, or redistribute it subject to the terms and conditions of the GNU
         * Lesser General Public License, as published by the Free Software Foundation.
         *
         * This program is distributed in the hope that it will be useful,
         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
         * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
         * for more details.
         *
         * You should have received a copy of the GNU Lesser General Public License
         * along with this distribution; if not, write to:
         * Free Software Foundation, Inc.
         * 51 Franklin Street, Fifth Floor
         * Boston, MA  02110-1301  USA
         *
         */
        package org.hibernate.proxy;

        import java.io.Serializable;

        import org.hibernate.HibernateException;
        import org.hibernate.engine.SessionImplementor;

        /**
         * Handles fetching of the underlying entity for a proxy
         *
         * @author Gavin King
         * @author Steve Ebersole
         */
        public interface LazyInitializer {
            /**
             * Initialize the proxy, fetching the target entity if necessary.
             *
             * @throws HibernateException Indicates a problem initializing the proxy.
             */
            public void initialize() throws HibernateException;

            /**
             * Retrieve the identifier value for the enity our owning proxy represents.
             *
             * @return The identifier value.
             */
            public Serializable getIdentifier();

            /**
             * Set the identifier value for the enity our owning proxy represents.
             *
             * @param id The identifier value.
             */
            public void setIdentifier(Serializable id);

            /**
             * The entity-name of the entity our owning proxy represents.
             *
             * @return The entity-name.
             */
            public String getEntityName();

            /**
             * Get the actual class of the entity.  Generally, {@link #getEntityName()} should be used instead.
             *
             * @return The actual entity class.
             */
            public Class getPersistentClass();

            /**
             * Is the proxy uninitialzed?
             *
             * @return True if uninitialized; false otherwise.
             */
            public boolean isUninitialized();

            /**
             * Return the underlying persistent object, initializing if necessary
             *
             * @return The underlying target entity.
             */
            public Object getImplementation();

            /**
             * Return the underlying persistent object in the given session, or null if not contained in this session's
             * persistence context.
             *
             * @param session The session to check
             *
             * @return The target, or null.
             *
             * @throws HibernateException Indicates problem locating the target.
             */
            public abstract Object getImplementation(SessionImplementor session)
                    throws HibernateException;

            /**
             * Initialize the proxy manually by injecting its target.
             *
             * @param target The proxy target (the actual entity being proxied).
             */
            public void setImplementation(Object target);

            /**
             * Is the proxy read-only?.
             *
             * @return true, if this proxy is read-only; false, otherwise
             * @throws org.hibernate.TransientObjectException if the proxy is not association with a session
             * @throws org.hibernate.SessionException if the proxy is associated with a sesssion that is closed
             *
             * @see org.hibernate.Session#isReadOnly(Object entityOrProxy)
             */
            public boolean isReadOnly();

            /**
             * Set an associated modifiable proxy to read-only mode, or a read-only
             * proxy to modifiable mode. If the proxy is currently initialized, its
             * implementation will be set to the same mode; otherwise, when the
             * proxy is initialized, its implementation will have the same read-only/
             * modifiable setting as the proxy. In read-only mode, no snapshot is
             * maintained and the instance is never dirty checked.
             *
             * If the associated proxy already has the specified read-only/modifiable
             * setting, then this method does nothing.
             *
             * @param readOnly, if true, the associated proxy is made read-only;
             *                  if false, the associated proxy is made modifiable.
             * @throws org.hibernate.TransientObjectException if the proxy is not association with a session
             * @throws org.hibernate.SessionException if the proxy is associated with a sesssion that is closed
             * 
             * @see org.hibernate.Session#setReadOnly(Object entityOrProxy, boolean readOnly)
             */
            public void setReadOnly(boolean readOnly);

            /**
             * Get the session to which this proxy is associated, or null if it is not attached.
             *
             * @return The associated session.
             */
            public SessionImplementor getSession();

            /**
             * Associate the proxy with the given session.
             * <p/>
             * Care should be given to make certain that the proxy is added to the session's persistence context as well
             * to maintain the symetry of the association.  That must be done seperately as this method simply sets an
             * internal reference.  We do also check that if there is already an associated session that the proxy
             * reference was removed from that previous session's persistence contet.
             *
             * @param session The session
             * @throws HibernateException Indicates that the proxy was still contained in the persistence context of the
             * "previous session".
             */
            public void setSession(SessionImplementor session)
                    throws HibernateException;

            /**
             * Unset this initializer's reference to session.  It is assumed that the caller is also taking care or
             * cleaning up the owning proxy's reference in the persistence context.
             * <p/>
             * Generally speaking this is intended to be called only during {@link org.hibernate.Session#evict} and
             * {@link org.hibernate.Session#clear} processing; most other use-cases should call {@link #setSession} instead.
             */
            public void unsetSession();

            public void setUnwrap(boolean unwrap);

            public boolean isUnwrap();
        }
www._j__a___v_a___2_s.___c___o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.