public final class Hibernate extends Object
<ul> <li>Provides access to the full range of Hibernate built-in types. <tt>Type</tt> instances may be used to bind values to query parameters. <li>A factory for new <tt>Blob</tt>s and <tt>Clob</tt>s. <li>Defines static methods for manipulation of proxies. </ul>
Modifier and Type | Method and Description |
---|---|
static void |
close(Iterator iterator)
Close an
Iterator instances obtained from Query.iterate() immediately
instead of waiting until the session is closed or disconnected. |
static Class |
getClass(Object proxy)
Get the true, underlying class of a proxied persistent class.
|
static LobCreator |
getLobCreator(Session session)
Obtain a lob creator for the given session.
|
static LobCreator |
getLobCreator(SessionImplementor session)
Obtain a lob creator for the given session.
|
static LobCreator |
getLobCreator(SharedSessionContractImplementor session)
Obtain a lob creator for the given session.
|
static void |
initialize(Object proxy)
Force initialization of a proxy or persistent collection.
|
static boolean |
isInitialized(Object proxy)
Check if the proxy or persistent collection is initialized.
|
static boolean |
isPropertyInitialized(Object proxy,
String propertyName)
Check if the property is initialized.
|
static Object |
unproxy(Object proxy)
Unproxies a
HibernateProxy . |
public static void initialize(Object proxy) throws HibernateException
Force initialization of a proxy or persistent collection. <p/> Note: This only ensures intialization of a proxy object or collection; it is not guaranteed that the elements INSIDE the collection will be initialized/materialized.
proxy
- a persistable object, proxy, persistent collection or <tt>null</tt>HibernateException
- if we can’t initialize the proxy at this time, eg. the <tt>Session</tt> was closedpublic static boolean isInitialized(Object proxy)
Check if the proxy or persistent collection is initialized.
proxy
- a persistable object, proxy, persistent collection or <tt>null</tt>public static Class getClass(Object proxy)
Get the true, underlying class of a proxied persistent class. This operation will initialize a proxy by side-effect.
proxy
- a persistable object or proxyHibernateException
public static LobCreator getLobCreator(Session session)
Obtain a lob creator for the given session.
session
- The session for which to obtain a lob creatorpublic static LobCreator getLobCreator(SharedSessionContractImplementor session)
Obtain a lob creator for the given session.
session
- The session for which to obtain a lob creatorpublic static LobCreator getLobCreator(SessionImplementor session)
Obtain a lob creator for the given session.
session
- The session for which to obtain a lob creatorpublic static void close(Iterator iterator) throws HibernateException
Close an Iterator
instances obtained from Query.iterate()
immediately
instead of waiting until the session is closed or disconnected.
iterator
- an Iterator created by iterate()HibernateException
- Indicates a problem closing the Hibernate iterator.IllegalArgumentException
- If the Iterator is not a "Hibernate Iterator".Query.iterate()
public static boolean isPropertyInitialized(Object proxy, String propertyName)
Check if the property is initialized. If the named property does not exist or is not persistent, this method always returns <tt>true</tt>.
proxy
- The potential proxypropertyName
- the name of a persistent attribute of the objectpublic static Object unproxy(Object proxy)
Unproxies a HibernateProxy
. If the proxy is uninitialized, it automatically triggers an initialization.
In case the supplied object is null or not a proxy, the object will be returned as-is.
proxy
- the HibernateProxy
to be unproxiedCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.