站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 3.2.4 正式版 API 英文文档

Hibernate (Hibernate API Documentation) - Hibernate 3.2.4 正式版 API 英文文档


org.hibernate
Class Hibernate

java.lang.Object
  extended byorg.hibernate.Hibernate

public final class Hibernate
extends Object

Author:
Gavin King
See Also:
Clob, Blob, Type

Field Summary
static NullableType BIG_DECIMAL
          Hibernate big_decimal type.
static NullableType BIG_INTEGER
          Hibernate big_integer type.
static NullableType BINARY
          Hibernate binary type.
static Type BLOB
          Hibernate blob type.
static NullableType BOOLEAN
          Hibernate boolean type.
static NullableType BYTE
          Hibernate byte type.
static NullableType CALENDAR
          Hibernate calendar type.
static NullableType CALENDAR_DATE
          Hibernate calendar_date type.
static NullableType CHAR_ARRAY
          Hibernate char[] type.
static NullableType CHARACTER
          Hibernate character type.
static NullableType CHARACTER_ARRAY
          Hibernate Character[] type.
static NullableType CLASS
          Hibernate class type.
static Type CLOB
          Hibernate clob type.
static NullableType CURRENCY
          Hibernate currency type.
static NullableType DATE
          Hibernate date type.
static NullableType DOUBLE
          Hibernate double type.
static NullableType FLOAT
          Hibernate float type.
static NullableType INTEGER
          Hibernate integer type.
static NullableType LOCALE
          Hibernate locale type.
static NullableType LONG
          Hibernate long type.
static Type OBJECT
          Hibernate object type.
static NullableType SERIALIZABLE
          Hibernate serializable type.
static NullableType SHORT
          Hibernate short type.
static NullableType STRING
          Hibernate string type.
static NullableType TEXT
          Hibernate text type.
static NullableType TIME
          Hibernate time type.
static NullableType TIMESTAMP
          Hibernate timestamp type.
static NullableType TIMEZONE
          Hibernate timezone type.
static NullableType TRUE_FALSE
          Hibernate true_false type.
static NullableType WRAPPER_BINARY
          Hibernate wrapper-binary type.
static NullableType YES_NO
          Hibernate yes_no type.
 
Method Summary
static Type any(Type metaType, Type identifierType)
          A Hibernate any type.
static void close(Iterator iterator)
          Close an Iterator created by iterate() immediately, instead of waiting until the session is closed or disconnected.
static Blob createBlob(byte[] bytes)
          Create a new Blob.
static Blob createBlob(InputStream stream)
          Create a new Blob.
static Blob createBlob(InputStream stream, int length)
          Create a new Blob.
static Clob createClob(Reader reader, int length)
          Create a new Clob.
static Clob createClob(String string)
          Create a new Clob.
static Type custom(Class userTypeClass)
          A Hibernate custom type.
static Type custom(Class userTypeClass, Properties parameters)
          A Hibernate parameterizable custom type.
static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues)
          A Hibernate parameterizable custom type.
static Type entity(Class persistentClass)
          A Hibernate persistent object (entity) type.
static Type entity(String entityName)
          A Hibernate persistent object (entity) type.
static Class getClass(Object proxy)
          Get the true, underlying class of a proxied persistent class.
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 Type serializable(Class serializableClass)
          A Hibernate serializable type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LONG

public static final NullableType LONG
Hibernate long type.


SHORT

public static final NullableType SHORT
Hibernate short type.


INTEGER

public static final NullableType INTEGER
Hibernate integer type.


BYTE

public static final NullableType BYTE
Hibernate byte type.


FLOAT

public static final NullableType FLOAT
Hibernate float type.


DOUBLE

public static final NullableType DOUBLE
Hibernate double type.


CHARACTER

public static final NullableType CHARACTER
Hibernate character type.


STRING

public static final NullableType STRING
Hibernate string type.


TIME

public static final NullableType TIME
Hibernate time type.


DATE

public static final NullableType DATE
Hibernate date type.


TIMESTAMP

public static final NullableType TIMESTAMP
Hibernate timestamp type.


BOOLEAN

public static final NullableType BOOLEAN
Hibernate boolean type.


TRUE_FALSE

public static final NullableType TRUE_FALSE
Hibernate true_false type.


YES_NO

public static final NullableType YES_NO
Hibernate yes_no type.


BIG_DECIMAL

public static final NullableType BIG_DECIMAL
Hibernate big_decimal type.


BIG_INTEGER

public static final NullableType BIG_INTEGER
Hibernate big_integer type.


BINARY

public static final NullableType BINARY
Hibernate binary type.


WRAPPER_BINARY

public static final NullableType WRAPPER_BINARY
Hibernate wrapper-binary type.


CHAR_ARRAY

public static final NullableType CHAR_ARRAY
Hibernate char[] type.


CHARACTER_ARRAY

public static final NullableType CHARACTER_ARRAY
Hibernate Character[] type.


TEXT

public static final NullableType TEXT
Hibernate text type.


BLOB

public static final Type BLOB
Hibernate blob type.


CLOB

public static final Type CLOB
Hibernate clob type.


CALENDAR

public static final NullableType CALENDAR
Hibernate calendar type.


CALENDAR_DATE

public static final NullableType CALENDAR_DATE
Hibernate calendar_date type.


LOCALE

public static final NullableType LOCALE
Hibernate locale type.


CURRENCY

public static final NullableType CURRENCY
Hibernate currency type.


TIMEZONE

public static final NullableType TIMEZONE
Hibernate timezone type.


CLASS

public static final NullableType CLASS
Hibernate class type.


SERIALIZABLE

public static final NullableType SERIALIZABLE
Hibernate serializable type.


OBJECT

public static final Type OBJECT
Hibernate object type.

Method Detail

serializable

public static Type serializable(Class serializableClass)
A Hibernate serializable type.


any

public static Type any(Type metaType,
                       Type identifierType)
A Hibernate any type.

Parameters:
metaType - a type mapping java.lang.Class to a single column
identifierType - the entity identifier type
Returns:
the Type

entity

public static Type entity(Class persistentClass)
A Hibernate persistent object (entity) type.

Parameters:
persistentClass - a mapped entity class

entity

public static Type entity(String entityName)
A Hibernate persistent object (entity) type.

Parameters:
entityName - a mapped entity class

custom

public static Type custom(Class userTypeClass)
                   throws HibernateException
A Hibernate custom type.

Parameters:
userTypeClass - a class that implements UserType
Throws:
HibernateException

custom

public static Type custom(Class userTypeClass,
                          String[] parameterNames,
                          String[] parameterValues)
                   throws HibernateException
A Hibernate parameterizable custom type.

Parameters:
userTypeClass - a class that implements UserType and ParameterizableType
parameterNames - the names of the parameters passed to the type
parameterValues - the values of the parameters passed to the type. They must match up with the order and length of the parameterNames array.
Throws:
HibernateException

custom

public static Type custom(Class userTypeClass,
                          Properties parameters)
                   throws HibernateException
A Hibernate parameterizable custom type.

Parameters:
userTypeClass - a class that implements UserType and ParameterizableType
parameters - the parameters as a collection of name/value pairs
Throws:
HibernateException

initialize

public static void initialize(Object proxy)
                       throws HibernateException
Force initialization of a proxy or persistent collection.

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.

Parameters:
proxy - a persistable object, proxy, persistent collection or null
Throws:
HibernateException - if we can't initialize the proxy at this time, eg. the Session was closed

isInitialized

public static boolean isInitialized(Object proxy)
Check if the proxy or persistent collection is initialized.

Parameters:
proxy - a persistable object, proxy, persistent collection or null
Returns:
true if the argument is already initialized, or is not a proxy or collection

getClass

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.

Parameters:
proxy - a persistable object or proxy
Returns:
the true class of the instance
Throws:
HibernateException

createBlob

public static Blob createBlob(byte[] bytes)
Create a new Blob. The returned object will be initially immutable.

Parameters:
bytes - a byte array
Returns:
the Blob

createBlob

public static Blob createBlob(InputStream stream,
                              int length)
Create a new Blob. The returned object will be initially immutable.

Parameters:
stream - a binary stream
length - the number of bytes in the stream
Returns:
the Blob

createBlob

public static Blob createBlob(InputStream stream)
                       throws IOException
Create a new Blob. The returned object will be initially immutable.

Parameters:
stream - a binary stream
Returns:
the Blob
Throws:
IOException

createClob

public static Clob createClob(String string)
Create a new Clob. The returned object will be initially immutable.

Parameters:
string - a String

createClob

public static Clob createClob(Reader reader,
                              int length)
Create a new Clob. The returned object will be initially immutable.

Parameters:
reader - a character stream
length - the number of characters in the stream

close

public static void close(Iterator iterator)
                  throws HibernateException
Close an Iterator created by iterate() immediately, instead of waiting until the session is closed or disconnected.

Parameters:
iterator - an Iterator created by iterate()
Throws:
HibernateException
See Also:
Query.iterate(), Query.iterate()

isPropertyInitialized

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 true.

Parameters:
proxy - The potential proxy
propertyName - the name of a persistent attribute of the object
Returns:
true if the named property of the object is not listed as uninitialized