HHH-6967 - HHH-6906 - Clean up javadoc warnings
This commit is contained in:
parent
5e8b74d8e8
commit
e75b8a77b1
|
@ -246,7 +246,7 @@ public interface Criteria extends CriteriaSpecification {
|
||||||
* @return this (for method chaining)
|
* @return this (for method chaining)
|
||||||
*
|
*
|
||||||
* @throws HibernateException Indicates a problem creating the sub criteria
|
* @throws HibernateException Indicates a problem creating the sub criteria
|
||||||
* @deprecated use {@link #createAlias(String, String, JoinType, Criterion}
|
* @deprecated use {@link #createAlias(String, String, JoinType, Criterion)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Criteria createAlias(String associationPath, String alias, int joinType, Criterion withClause) throws HibernateException;
|
public Criteria createAlias(String associationPath, String alias, int joinType, Criterion withClause) throws HibernateException;
|
||||||
|
@ -453,6 +453,7 @@ public interface Criteria extends CriteriaSpecification {
|
||||||
*
|
*
|
||||||
* @param readOnly true, entities and proxies loaded by the criteria will be put in read-only mode
|
* @param readOnly true, entities and proxies loaded by the criteria will be put in read-only mode
|
||||||
* false, entities and proxies loaded by the criteria will be put in modifiable mode
|
* false, entities and proxies loaded by the criteria will be put in modifiable mode
|
||||||
|
* @return {@code this}, for method chaining
|
||||||
*/
|
*/
|
||||||
public Criteria setReadOnly(boolean readOnly);
|
public Criteria setReadOnly(boolean readOnly);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* 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
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate;
|
package org.hibernate;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@ -45,9 +45,11 @@ import org.hibernate.type.Type;
|
||||||
* Instead of implementing this interface directly, it is usually better to extend <tt>EmptyInterceptor</tt>
|
* Instead of implementing this interface directly, it is usually better to extend <tt>EmptyInterceptor</tt>
|
||||||
* and override only the callback methods of interest.
|
* and override only the callback methods of interest.
|
||||||
*
|
*
|
||||||
* @see SessionFactory#openSession(Interceptor)
|
* @see SessionBuilder#interceptor(Interceptor)
|
||||||
|
* @see SharedSessionBuilder#interceptor()
|
||||||
* @see org.hibernate.cfg.Configuration#setInterceptor(Interceptor)
|
* @see org.hibernate.cfg.Configuration#setInterceptor(Interceptor)
|
||||||
* @see EmptyInterceptor
|
* @see EmptyInterceptor
|
||||||
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public interface Interceptor {
|
public interface Interceptor {
|
||||||
|
@ -55,52 +57,122 @@ public interface Interceptor {
|
||||||
* Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will
|
* Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will
|
||||||
* be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be
|
* be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be
|
||||||
* an empty uninitialized instance of the class.
|
* an empty uninitialized instance of the class.
|
||||||
|
* <p/>
|
||||||
|
* NOTE: The indexes across the <tt>state</tt>, <tt>propertyNames</tt> and <tt>types</tt> arrays match.
|
||||||
*
|
*
|
||||||
* @return <tt>true</tt> if the user modified the <tt>state</tt> in any way.
|
* @param entity The entity instance being loaded
|
||||||
|
* @param id The identifier value being loaded
|
||||||
|
* @param state The entity state (which will be pushed into the entity instance)
|
||||||
|
* @param propertyNames The names of the entity properties, corresponding to the <tt>state</tt>.
|
||||||
|
* @param types The types of the entity properties, corresponding to the <tt>state</tt>.
|
||||||
|
*
|
||||||
|
* @return {@code true} if the user modified the <tt>state</tt> in any way.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
|
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
|
* Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
|
||||||
* <tt>currentState</tt>, which will be propagated to both the database and the persistent object.
|
* <tt>currentState</tt>, which will be propagated to both the database and the persistent object.
|
||||||
* Note that not all flushes end in actual synchronization with the database, in which case the
|
* Note that not all flushes end in actual synchronization with the database, in which case the
|
||||||
* new <tt>currentState</tt> will be propagated to the object, but not necessarily (immediately) to
|
* new <tt>currentState</tt> will be propagated to the object, but not necessarily (immediately) to
|
||||||
* the database. It is strongly recommended that the interceptor <b>not</b> modify the <tt>previousState</tt>.
|
* the database. It is strongly recommended that the interceptor <b>not</b> modify the <tt>previousState</tt>.
|
||||||
|
* <p/>
|
||||||
|
* NOTE: The indexes across the <tt>currentState</tt>, <tt>previousState</tt>, <tt>propertyNames</tt> and
|
||||||
|
* <tt>types</tt> arrays match.
|
||||||
*
|
*
|
||||||
* @return <tt>true</tt> if the user modified the <tt>currentState</tt> in any way.
|
* @param entity The entity instance detected as being dirty and being flushed
|
||||||
|
* @param id The identifier of the entity
|
||||||
|
* @param currentState The entity's current state
|
||||||
|
* @param previousState The entity's previous (load time) state.
|
||||||
|
* @param propertyNames The names of the entity properties
|
||||||
|
* @param types The types of the entity properties
|
||||||
|
*
|
||||||
|
* @return {@code true} if the user modified the <tt>currentState</tt> in any way.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException;
|
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for
|
* Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for
|
||||||
* the SQL <tt>INSERT</tt> and propagated to the persistent object.
|
* the SQL <tt>INSERT</tt> and propagated to the persistent object.
|
||||||
*
|
*
|
||||||
|
* @param entity The entity instance whose state is being inserted
|
||||||
|
* @param id The identifier of the entity
|
||||||
|
* @param state The state of the entity which will be inserted
|
||||||
|
* @param propertyNames The names of the entity properties.
|
||||||
|
* @param types The types of the entity properties
|
||||||
|
*
|
||||||
* @return <tt>true</tt> if the user modified the <tt>state</tt> in any way.
|
* @return <tt>true</tt> if the user modified the <tt>state</tt> in any way.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
|
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before an object is deleted. It is not recommended that the interceptor modify the <tt>state</tt>.
|
* Called before an object is deleted. It is not recommended that the interceptor modify the <tt>state</tt>.
|
||||||
|
*
|
||||||
|
* @param entity The entity instance being deleted
|
||||||
|
* @param id The identifier of the entity
|
||||||
|
* @param state The state of the entity
|
||||||
|
* @param propertyNames The names of the entity properties.
|
||||||
|
* @param types The types of the entity properties
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
|
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a collection is (re)created.
|
* Called before a collection is (re)created.
|
||||||
|
*
|
||||||
|
* @param collection The collection instance.
|
||||||
|
* @param key The collection key value.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
|
public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a collection is deleted.
|
* Called before a collection is deleted.
|
||||||
|
*
|
||||||
|
* @param collection The collection instance.
|
||||||
|
* @param key The collection key value.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException;
|
public void onCollectionRemove(Object collection, Serializable key) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a collection is updated.
|
* Called before a collection is updated.
|
||||||
|
*
|
||||||
|
* @param collection The collection instance.
|
||||||
|
* @param key The collection key value.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
|
public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a flush
|
* Called before a flush
|
||||||
|
*
|
||||||
|
* @param entities The entities to be flushed
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public void preFlush(Iterator entities) throws CallbackException;
|
public void preFlush(Iterator entities) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after a flush that actually ends in execution of the SQL statements required to synchronize
|
* Called after a flush that actually ends in execution of the SQL statements required to synchronize
|
||||||
* in-memory state with the database.
|
* in-memory state with the database.
|
||||||
|
*
|
||||||
|
* @param entities The entities that were flushed.
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public void postFlush(Iterator entities) throws CallbackException;
|
public void postFlush(Iterator entities) throws CallbackException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to distinguish between transient and detached entities. The return value determines the
|
* Called to distinguish between transient and detached entities. The return value determines the
|
||||||
* state of the entity with respect to the current session.
|
* state of the entity with respect to the current session.
|
||||||
|
@ -114,6 +186,7 @@ public interface Interceptor {
|
||||||
* @return Boolean or <tt>null</tt> to choose default behaviour
|
* @return Boolean or <tt>null</tt> to choose default behaviour
|
||||||
*/
|
*/
|
||||||
public Boolean isTransient(Object entity);
|
public Boolean isTransient(Object entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called from <tt>flush()</tt>. The return value determines whether the entity is updated
|
* Called from <tt>flush()</tt>. The return value determines whether the entity is updated
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -121,8 +194,17 @@ public interface Interceptor {
|
||||||
* <li>an empty array - the entity is not dirty
|
* <li>an empty array - the entity is not dirty
|
||||||
* <li><tt>null</tt> - use Hibernate's default dirty-checking algorithm
|
* <li><tt>null</tt> - use Hibernate's default dirty-checking algorithm
|
||||||
* </ul>
|
* </ul>
|
||||||
* @param entity a persistent entity
|
*
|
||||||
* @return array of dirty property indices or <tt>null</tt> to choose default behaviour
|
* @param entity The entity for which to find dirty properties.
|
||||||
|
* @param id The identifier of the entity
|
||||||
|
* @param currentState The current entity state as taken from the entity instance
|
||||||
|
* @param previousState The state of the entity when it was last synchronized (generally when it was loaded)
|
||||||
|
* @param propertyNames The names of the entity properties.
|
||||||
|
* @param types The types of the entity properties
|
||||||
|
*
|
||||||
|
* @return array of dirty property indices or {@code null} to indicate Hibernate should perform default behaviour
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types);
|
public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types);
|
||||||
/**
|
/**
|
||||||
|
@ -134,6 +216,8 @@ public interface Interceptor {
|
||||||
* @param entityMode The type of entity instance to be returned.
|
* @param entityMode The type of entity instance to be returned.
|
||||||
* @param id the identifier of the new instance
|
* @param id the identifier of the new instance
|
||||||
* @return an instance of the class, or <tt>null</tt> to choose default behaviour
|
* @return an instance of the class, or <tt>null</tt> to choose default behaviour
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException;
|
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException;
|
||||||
|
|
||||||
|
@ -141,6 +225,8 @@ public interface Interceptor {
|
||||||
* Get the entity name for a persistent or transient instance
|
* Get the entity name for a persistent or transient instance
|
||||||
* @param object an entity instance
|
* @param object an entity instance
|
||||||
* @return the name of the entity
|
* @return the name of the entity
|
||||||
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public String getEntityName(Object object) throws CallbackException;
|
public String getEntityName(Object object) throws CallbackException;
|
||||||
|
|
||||||
|
@ -149,7 +235,8 @@ public interface Interceptor {
|
||||||
* @param entityName the name of the entity
|
* @param entityName the name of the entity
|
||||||
* @param id the instance identifier
|
* @param id the instance identifier
|
||||||
* @return a fully initialized entity
|
* @return a fully initialized entity
|
||||||
* @throws CallbackException
|
*
|
||||||
|
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||||
*/
|
*/
|
||||||
public Object getEntity(String entityName, Serializable id) throws CallbackException;
|
public Object getEntity(String entityName, Serializable id) throws CallbackException;
|
||||||
|
|
||||||
|
@ -157,14 +244,22 @@ public interface Interceptor {
|
||||||
* Called when a Hibernate transaction is begun via the Hibernate <tt>Transaction</tt>
|
* Called when a Hibernate transaction is begun via the Hibernate <tt>Transaction</tt>
|
||||||
* API. Will not be called if transactions are being controlled via some other
|
* API. Will not be called if transactions are being controlled via some other
|
||||||
* mechanism (CMT, for example).
|
* mechanism (CMT, for example).
|
||||||
|
*
|
||||||
|
* @param tx The Hibernate transaction facade object
|
||||||
*/
|
*/
|
||||||
public void afterTransactionBegin(Transaction tx);
|
public void afterTransactionBegin(Transaction tx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before a transaction is committed (but not before rollback).
|
* Called before a transaction is committed (but not before rollback).
|
||||||
|
*
|
||||||
|
* @param tx The Hibernate transaction facade object
|
||||||
*/
|
*/
|
||||||
public void beforeTransactionCompletion(Transaction tx);
|
public void beforeTransactionCompletion(Transaction tx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after a transaction is committed or rolled back.
|
* Called after a transaction is committed or rolled back.
|
||||||
|
*
|
||||||
|
* @param tx The Hibernate transaction facade object
|
||||||
*/
|
*/
|
||||||
public void afterTransactionCompletion(Transaction tx);
|
public void afterTransactionCompletion(Transaction tx);
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ public interface Session extends SharedSessionContract {
|
||||||
* @throws TransientObjectException if the instance is transient or associated with
|
* @throws TransientObjectException if the instance is transient or associated with
|
||||||
* a different session
|
* a different session
|
||||||
*/
|
*/
|
||||||
public Serializable getIdentifier(Object object) throws HibernateException;
|
public Serializable getIdentifier(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this instance is associated with this <tt>Session</tt>.
|
* Check if this instance is associated with this <tt>Session</tt>.
|
||||||
|
@ -267,9 +267,8 @@ public interface Session extends SharedSessionContract {
|
||||||
* instances if the association is mapped with <tt>cascade="evict"</tt>.
|
* instances if the association is mapped with <tt>cascade="evict"</tt>.
|
||||||
*
|
*
|
||||||
* @param object a persistent instance
|
* @param object a persistent instance
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void evict(Object object) throws HibernateException;
|
public void evict(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -278,12 +277,13 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param theClass a persistent class
|
* @param theClass a persistent class
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
* @param lockMode the lock level
|
* @param lockMode the lock level
|
||||||
|
*
|
||||||
* @return the persistent instance or proxy
|
* @return the persistent instance or proxy
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated LockMode parameter should be replaced with LockOptions
|
* @deprecated LockMode parameter should be replaced with LockOptions
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Object load(Class theClass, Serializable id, LockMode lockMode) throws HibernateException;
|
public Object load(Class theClass, Serializable id, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -293,9 +293,8 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
* @param lockOptions contains the lock level
|
* @param lockOptions contains the lock level
|
||||||
* @return the persistent instance or proxy
|
* @return the persistent instance or proxy
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object load(Class theClass, Serializable id, LockOptions lockOptions) throws HibernateException;
|
public Object load(Class theClass, Serializable id, LockOptions lockOptions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -304,12 +303,13 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param entityName a persistent class
|
* @param entityName a persistent class
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
* @param lockMode the lock level
|
* @param lockMode the lock level
|
||||||
|
*
|
||||||
* @return the persistent instance or proxy
|
* @return the persistent instance or proxy
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated LockMode parameter should be replaced with LockOptions
|
* @deprecated LockMode parameter should be replaced with LockOptions
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Object load(String entityName, Serializable id, LockMode lockMode) throws HibernateException;
|
public Object load(String entityName, Serializable id, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -318,10 +318,10 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param entityName a persistent class
|
* @param entityName a persistent class
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
* @param lockOptions contains the lock level
|
* @param lockOptions contains the lock level
|
||||||
|
*
|
||||||
* @return the persistent instance or proxy
|
* @return the persistent instance or proxy
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object load(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException;
|
public Object load(String entityName, Serializable id, LockOptions lockOptions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -334,10 +334,10 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param theClass a persistent class
|
* @param theClass a persistent class
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
|
*
|
||||||
* @return the persistent instance or proxy
|
* @return the persistent instance or proxy
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object load(Class theClass, Serializable id) throws HibernateException;
|
public Object load(Class theClass, Serializable id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -350,10 +350,10 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param entityName a persistent class
|
* @param entityName a persistent class
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
|
*
|
||||||
* @return the persistent instance or proxy
|
* @return the persistent instance or proxy
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object load(String entityName, Serializable id) throws HibernateException;
|
public Object load(String entityName, Serializable id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the persistent state associated with the given identifier into the given transient
|
* Read the persistent state associated with the given identifier into the given transient
|
||||||
|
@ -361,51 +361,54 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param object an "empty" instance of the persistent class
|
* @param object an "empty" instance of the persistent class
|
||||||
* @param id a valid identifier of an existing persistent instance of the class
|
* @param id a valid identifier of an existing persistent instance of the class
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void load(Object object, Serializable id) throws HibernateException;
|
public void load(Object object, Serializable id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist the state of the given detached instance, reusing the current
|
* Persist the state of the given detached instance, reusing the current
|
||||||
* identifier value. This operation cascades to associated instances if
|
* identifier value. This operation cascades to associated instances if
|
||||||
* the association is mapped with <tt>cascade="replicate"</tt>.
|
* the association is mapped with {@code cascade="replicate"}
|
||||||
*
|
*
|
||||||
* @param object a detached instance of a persistent class
|
* @param object a detached instance of a persistent class
|
||||||
|
* @param replicationMode The replication mode to use
|
||||||
*/
|
*/
|
||||||
public void replicate(Object object, ReplicationMode replicationMode) throws HibernateException;
|
public void replicate(Object object, ReplicationMode replicationMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist the state of the given detached instance, reusing the current
|
* Persist the state of the given detached instance, reusing the current
|
||||||
* identifier value. This operation cascades to associated instances if
|
* identifier value. This operation cascades to associated instances if
|
||||||
* the association is mapped with <tt>cascade="replicate"</tt>.
|
* the association is mapped with {@code cascade="replicate"}
|
||||||
*
|
*
|
||||||
|
* @param entityName The entity name
|
||||||
* @param object a detached instance of a persistent class
|
* @param object a detached instance of a persistent class
|
||||||
|
* @param replicationMode The replication mode to use
|
||||||
*/
|
*/
|
||||||
public void replicate(String entityName, Object object, ReplicationMode replicationMode) throws HibernateException;
|
public void replicate(String entityName, Object object, ReplicationMode replicationMode) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist the given transient instance, first assigning a generated identifier. (Or
|
* Persist the given transient instance, first assigning a generated identifier. (Or
|
||||||
* using the current value of the identifier property if the <tt>assigned</tt>
|
* using the current value of the identifier property if the <tt>assigned</tt>
|
||||||
* generator is used.) This operation cascades to associated instances if the
|
* generator is used.) This operation cascades to associated instances if the
|
||||||
* association is mapped with <tt>cascade="save-update"</tt>.
|
* association is mapped with {@code cascade="save-update"}
|
||||||
*
|
*
|
||||||
* @param object a transient instance of a persistent class
|
* @param object a transient instance of a persistent class
|
||||||
|
*
|
||||||
* @return the generated identifier
|
* @return the generated identifier
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Serializable save(Object object) throws HibernateException;
|
public Serializable save(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist the given transient instance, first assigning a generated identifier. (Or
|
* Persist the given transient instance, first assigning a generated identifier. (Or
|
||||||
* using the current value of the identifier property if the <tt>assigned</tt>
|
* using the current value of the identifier property if the <tt>assigned</tt>
|
||||||
* generator is used.) This operation cascades to associated instances if the
|
* generator is used.) This operation cascades to associated instances if the
|
||||||
* association is mapped with <tt>cascade="save-update"</tt>.
|
* association is mapped with {@code cascade="save-update"}
|
||||||
*
|
*
|
||||||
|
* @param entityName The entity name
|
||||||
* @param object a transient instance of a persistent class
|
* @param object a transient instance of a persistent class
|
||||||
|
*
|
||||||
* @return the generated identifier
|
* @return the generated identifier
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Serializable save(String entityName, Object object) throws HibernateException;
|
public Serializable save(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Either {@link #save(Object)} or {@link #update(Object)} the given
|
* Either {@link #save(Object)} or {@link #update(Object)} the given
|
||||||
|
@ -413,14 +416,14 @@ public interface Session extends SharedSessionContract {
|
||||||
* manual for discussion of unsaved-value checking).
|
* manual for discussion of unsaved-value checking).
|
||||||
* <p/>
|
* <p/>
|
||||||
* This operation cascades to associated instances if the association is mapped
|
* This operation cascades to associated instances if the association is mapped
|
||||||
* with <tt>cascade="save-update"</tt>.
|
* with {@code cascade="save-update"}
|
||||||
|
*
|
||||||
|
* @param object a transient or detached instance containing new or updated state
|
||||||
*
|
*
|
||||||
* @see Session#save(java.lang.Object)
|
* @see Session#save(java.lang.Object)
|
||||||
* @see Session#update(Object object)
|
* @see Session#update(Object object)
|
||||||
* @param object a transient or detached instance containing new or updated state
|
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void saveOrUpdate(Object object) throws HibernateException;
|
public void saveOrUpdate(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Either {@link #save(String, Object)} or {@link #update(String, Object)}
|
* Either {@link #save(String, Object)} or {@link #update(String, Object)}
|
||||||
|
@ -428,36 +431,36 @@ public interface Session extends SharedSessionContract {
|
||||||
* (see the manual for discussion of unsaved-value checking).
|
* (see the manual for discussion of unsaved-value checking).
|
||||||
* <p/>
|
* <p/>
|
||||||
* This operation cascades to associated instances if the association is mapped
|
* This operation cascades to associated instances if the association is mapped
|
||||||
* with <tt>cascade="save-update"</tt>.
|
* with {@code cascade="save-update"}
|
||||||
|
*
|
||||||
|
* @param entityName The entity name
|
||||||
|
* @param object a transient or detached instance containing new or updated state
|
||||||
*
|
*
|
||||||
* @see Session#save(String,Object)
|
* @see Session#save(String,Object)
|
||||||
* @see Session#update(String,Object)
|
* @see Session#update(String,Object)
|
||||||
* @param object a transient or detached instance containing new or updated state
|
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void saveOrUpdate(String entityName, Object object) throws HibernateException;
|
public void saveOrUpdate(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the persistent instance with the identifier of the given detached
|
* Update the persistent instance with the identifier of the given detached
|
||||||
* instance. If there is a persistent instance with the same identifier,
|
* instance. If there is a persistent instance with the same identifier,
|
||||||
* an exception is thrown. This operation cascades to associated instances
|
* an exception is thrown. This operation cascades to associated instances
|
||||||
* if the association is mapped with <tt>cascade="save-update"</tt>.
|
* if the association is mapped with {@code cascade="save-update"}
|
||||||
*
|
*
|
||||||
* @param object a detached instance containing updated state
|
* @param object a detached instance containing updated state
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void update(Object object) throws HibernateException;
|
public void update(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the persistent instance with the identifier of the given detached
|
* Update the persistent instance with the identifier of the given detached
|
||||||
* instance. If there is a persistent instance with the same identifier,
|
* instance. If there is a persistent instance with the same identifier,
|
||||||
* an exception is thrown. This operation cascades to associated instances
|
* an exception is thrown. This operation cascades to associated instances
|
||||||
* if the association is mapped with <tt>cascade="save-update"</tt>.
|
* if the association is mapped with {@code cascade="save-update"}
|
||||||
*
|
*
|
||||||
|
* @param entityName The entity name
|
||||||
* @param object a detached instance containing updated state
|
* @param object a detached instance containing updated state
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void update(String entityName, Object object) throws HibernateException;
|
public void update(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the state of the given object onto the persistent object with the same
|
* Copy the state of the given object onto the persistent object with the same
|
||||||
|
@ -466,14 +469,15 @@ public interface Session extends SharedSessionContract {
|
||||||
* given instance is unsaved, save a copy of and return it as a newly persistent
|
* given instance is unsaved, save a copy of and return it as a newly persistent
|
||||||
* instance. The given instance does not become associated with the session.
|
* instance. The given instance does not become associated with the session.
|
||||||
* This operation cascades to associated instances if the association is mapped
|
* This operation cascades to associated instances if the association is mapped
|
||||||
* with <tt>cascade="merge"</tt>.<br>
|
* with {@code cascade="merge"}
|
||||||
* <br>
|
* <p/>
|
||||||
* The semantics of this method are defined by JSR-220.
|
* The semantics of this method are defined by JSR-220.
|
||||||
*
|
*
|
||||||
* @param object a detached instance with state to be copied
|
* @param object a detached instance with state to be copied
|
||||||
|
*
|
||||||
* @return an updated persistent instance
|
* @return an updated persistent instance
|
||||||
*/
|
*/
|
||||||
public Object merge(Object object) throws HibernateException;
|
public Object merge(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the state of the given object onto the persistent object with the same
|
* Copy the state of the given object onto the persistent object with the same
|
||||||
|
@ -482,58 +486,59 @@ public interface Session extends SharedSessionContract {
|
||||||
* given instance is unsaved, save a copy of and return it as a newly persistent
|
* given instance is unsaved, save a copy of and return it as a newly persistent
|
||||||
* instance. The given instance does not become associated with the session.
|
* instance. The given instance does not become associated with the session.
|
||||||
* This operation cascades to associated instances if the association is mapped
|
* This operation cascades to associated instances if the association is mapped
|
||||||
* with <tt>cascade="merge"</tt>.<br>
|
* with {@code cascade="merge"}
|
||||||
* <br>
|
* <p/>
|
||||||
* The semantics of this method are defined by JSR-220.
|
* The semantics of this method are defined by JSR-220.
|
||||||
*
|
*
|
||||||
|
* @param entityName The entity name
|
||||||
* @param object a detached instance with state to be copied
|
* @param object a detached instance with state to be copied
|
||||||
|
*
|
||||||
* @return an updated persistent instance
|
* @return an updated persistent instance
|
||||||
*/
|
*/
|
||||||
public Object merge(String entityName, Object object) throws HibernateException;
|
public Object merge(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a transient instance persistent. This operation cascades to associated
|
* Make a transient instance persistent. This operation cascades to associated
|
||||||
* instances if the association is mapped with <tt>cascade="persist"</tt>.<br>
|
* instances if the association is mapped with {@code cascade="persist"}
|
||||||
* <br>
|
* <p/>
|
||||||
* The semantics of this method are defined by JSR-220.
|
* The semantics of this method are defined by JSR-220.
|
||||||
*
|
*
|
||||||
* @param object a transient instance to be made persistent
|
* @param object a transient instance to be made persistent
|
||||||
*/
|
*/
|
||||||
public void persist(Object object) throws HibernateException;
|
public void persist(Object object);
|
||||||
/**
|
/**
|
||||||
* Make a transient instance persistent. This operation cascades to associated
|
* Make a transient instance persistent. This operation cascades to associated
|
||||||
* instances if the association is mapped with <tt>cascade="persist"</tt>.<br>
|
* instances if the association is mapped with {@code cascade="persist"}
|
||||||
* <br>
|
* <p/>
|
||||||
* The semantics of this method are defined by JSR-220.
|
* The semantics of this method are defined by JSR-220.
|
||||||
*
|
*
|
||||||
|
* @param entityName The entity name
|
||||||
* @param object a transient instance to be made persistent
|
* @param object a transient instance to be made persistent
|
||||||
*/
|
*/
|
||||||
public void persist(String entityName, Object object) throws HibernateException;
|
public void persist(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a persistent instance from the datastore. The argument may be
|
* Remove a persistent instance from the datastore. The argument may be
|
||||||
* an instance associated with the receiving <tt>Session</tt> or a transient
|
* an instance associated with the receiving <tt>Session</tt> or a transient
|
||||||
* instance with an identifier associated with existing persistent state.
|
* instance with an identifier associated with existing persistent state.
|
||||||
* This operation cascades to associated instances if the association is mapped
|
* This operation cascades to associated instances if the association is mapped
|
||||||
* with <tt>cascade="delete"</tt>.
|
* with {@code cascade="delete"}
|
||||||
*
|
*
|
||||||
* @param object the instance to be removed
|
* @param object the instance to be removed
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void delete(Object object) throws HibernateException;
|
public void delete(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a persistent instance from the datastore. The <b>object</b> argument may be
|
* Remove a persistent instance from the datastore. The <b>object</b> argument may be
|
||||||
* an instance associated with the receiving <tt>Session</tt> or a transient
|
* an instance associated with the receiving <tt>Session</tt> or a transient
|
||||||
* instance with an identifier associated with existing persistent state.
|
* instance with an identifier associated with existing persistent state.
|
||||||
* This operation cascades to associated instances if the association is mapped
|
* This operation cascades to associated instances if the association is mapped
|
||||||
* with <tt>cascade="delete"</tt>.
|
* with {@code cascade="delete"}
|
||||||
*
|
*
|
||||||
* @param entityName The entity name for the instance to be removed.
|
* @param entityName The entity name for the instance to be removed.
|
||||||
* @param object the instance to be removed
|
* @param object the instance to be removed
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void delete(String entityName, Object object) throws HibernateException;
|
public void delete(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the specified lock level upon the given object. This may be used to
|
* Obtain the specified lock level upon the given object. This may be used to
|
||||||
|
@ -544,11 +549,11 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param object a persistent or transient instance
|
* @param object a persistent or transient instance
|
||||||
* @param lockMode the lock level
|
* @param lockMode the lock level
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated instead call buildLockRequest(LockMode).lock(object)
|
* @deprecated instead call buildLockRequest(LockMode).lock(object)
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void lock(Object object, LockMode lockMode) throws HibernateException;
|
public void lock(Object object, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the specified lock level upon the given object. This may be used to
|
* Obtain the specified lock level upon the given object. This may be used to
|
||||||
|
@ -559,23 +564,24 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param object a persistent or transient instance
|
* @param object a persistent or transient instance
|
||||||
* @param lockMode the lock level
|
* @param lockMode the lock level
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated instead call buildLockRequest(LockMode).lock(entityName, object)
|
* @deprecated instead call buildLockRequest(LockMode).lock(entityName, object)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void lock(String entityName, Object object, LockMode lockMode) throws HibernateException;
|
public void lock(String entityName, Object object, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.
|
* Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.
|
||||||
* timeout and scope is ignored for optimistic locking. After building the LockRequest,
|
* timeout and scope is ignored for optimistic locking. After building the LockRequest,
|
||||||
* call LockRequest.lock to perform the requested locking.
|
* call LockRequest.lock to perform the requested locking.
|
||||||
*
|
* <p/>
|
||||||
* Use: session.buildLockRequest().
|
* Example usage:
|
||||||
* setLockMode(LockMode.PESSIMISTIC_WRITE).setTimeOut(1000 * 60).lock(entity);
|
* {@code session.buildLockRequest().setLockMode(LockMode.PESSIMISTIC_WRITE).setTimeOut(60000).lock(entity);}
|
||||||
*
|
*
|
||||||
* @param lockOptions contains the lock level
|
* @param lockOptions contains the lock level
|
||||||
|
*
|
||||||
* @return a lockRequest that can be used to lock the passed object.
|
* @return a lockRequest that can be used to lock the passed object.
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public LockRequest buildLockRequest(LockOptions lockOptions);
|
public LockRequest buildLockRequest(LockOptions lockOptions);
|
||||||
|
|
||||||
|
@ -591,9 +597,8 @@ public interface Session extends SharedSessionContract {
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param object a persistent or detached instance
|
* @param object a persistent or detached instance
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void refresh(Object object) throws HibernateException;
|
public void refresh(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-read the state of the given instance from the underlying database. It is
|
* Re-read the state of the given instance from the underlying database. It is
|
||||||
|
@ -608,9 +613,8 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param entityName a persistent class
|
* @param entityName a persistent class
|
||||||
* @param object a persistent or detached instance
|
* @param object a persistent or detached instance
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void refresh(String entityName, Object object) throws HibernateException;
|
public void refresh(String entityName, Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-read the state of the given instance from the underlying database, with
|
* Re-read the state of the given instance from the underlying database, with
|
||||||
|
@ -620,11 +624,11 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param object a persistent or detached instance
|
* @param object a persistent or detached instance
|
||||||
* @param lockMode the lock mode to use
|
* @param lockMode the lock mode to use
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated LockMode parameter should be replaced with LockOptions
|
* @deprecated LockMode parameter should be replaced with LockOptions
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void refresh(Object object, LockMode lockMode) throws HibernateException;
|
public void refresh(Object object, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-read the state of the given instance from the underlying database, with
|
* Re-read the state of the given instance from the underlying database, with
|
||||||
|
@ -634,9 +638,8 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param object a persistent or detached instance
|
* @param object a persistent or detached instance
|
||||||
* @param lockOptions contains the lock mode to use
|
* @param lockOptions contains the lock mode to use
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void refresh(Object object, LockOptions lockOptions) throws HibernateException;
|
public void refresh(Object object, LockOptions lockOptions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-read the state of the given instance from the underlying database, with
|
* Re-read the state of the given instance from the underlying database, with
|
||||||
|
@ -647,17 +650,17 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param entityName a persistent class
|
* @param entityName a persistent class
|
||||||
* @param object a persistent or detached instance
|
* @param object a persistent or detached instance
|
||||||
* @param lockOptions contains the lock mode to use
|
* @param lockOptions contains the lock mode to use
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public void refresh(String entityName, Object object, LockOptions lockOptions) throws HibernateException;
|
public void refresh(String entityName, Object object, LockOptions lockOptions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the current lock mode of the given object.
|
* Determine the current lock mode of the given object.
|
||||||
*
|
*
|
||||||
* @param object a persistent instance
|
* @param object a persistent instance
|
||||||
|
*
|
||||||
* @return the current lock mode
|
* @return the current lock mode
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public LockMode getCurrentLockMode(Object object) throws HibernateException;
|
public LockMode getCurrentLockMode(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@link Query} instance for the given collection and filter string. Contains an implicit {@code FROM}
|
* Create a {@link Query} instance for the given collection and filter string. Contains an implicit {@code FROM}
|
||||||
|
@ -685,10 +688,10 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param clazz a persistent class
|
* @param clazz a persistent class
|
||||||
* @param id an identifier
|
* @param id an identifier
|
||||||
|
*
|
||||||
* @return a persistent instance or null
|
* @return a persistent instance or null
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object get(Class clazz, Serializable id) throws HibernateException;
|
public Object get(Class clazz, Serializable id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -699,12 +702,13 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param clazz a persistent class
|
* @param clazz a persistent class
|
||||||
* @param id an identifier
|
* @param id an identifier
|
||||||
* @param lockMode the lock mode
|
* @param lockMode the lock mode
|
||||||
|
*
|
||||||
* @return a persistent instance or null
|
* @return a persistent instance or null
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated LockMode parameter should be replaced with LockOptions
|
* @deprecated LockMode parameter should be replaced with LockOptions
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Object get(Class clazz, Serializable id, LockMode lockMode) throws HibernateException;
|
public Object get(Class clazz, Serializable id, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -715,10 +719,10 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param clazz a persistent class
|
* @param clazz a persistent class
|
||||||
* @param id an identifier
|
* @param id an identifier
|
||||||
* @param lockOptions the lock mode
|
* @param lockOptions the lock mode
|
||||||
|
*
|
||||||
* @return a persistent instance or null
|
* @return a persistent instance or null
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object get(Class clazz, Serializable id, LockOptions lockOptions) throws HibernateException;
|
public Object get(Class clazz, Serializable id, LockOptions lockOptions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given named entity with the given identifier,
|
* Return the persistent instance of the given named entity with the given identifier,
|
||||||
|
@ -727,10 +731,10 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @param entityName the entity name
|
* @param entityName the entity name
|
||||||
* @param id an identifier
|
* @param id an identifier
|
||||||
|
*
|
||||||
* @return a persistent instance or null
|
* @return a persistent instance or null
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object get(String entityName, Serializable id) throws HibernateException;
|
public Object get(String entityName, Serializable id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -741,12 +745,13 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param entityName the entity name
|
* @param entityName the entity name
|
||||||
* @param id an identifier
|
* @param id an identifier
|
||||||
* @param lockMode the lock mode
|
* @param lockMode the lock mode
|
||||||
|
*
|
||||||
* @return a persistent instance or null
|
* @return a persistent instance or null
|
||||||
* @throws HibernateException
|
*
|
||||||
* @deprecated LockMode parameter should be replaced with LockOptions
|
* @deprecated LockMode parameter should be replaced with LockOptions
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Object get(String entityName, Serializable id, LockMode lockMode) throws HibernateException;
|
public Object get(String entityName, Serializable id, LockMode lockMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the persistent instance of the given entity class with the given identifier,
|
* Return the persistent instance of the given entity class with the given identifier,
|
||||||
|
@ -757,19 +762,19 @@ public interface Session extends SharedSessionContract {
|
||||||
* @param entityName the entity name
|
* @param entityName the entity name
|
||||||
* @param id an identifier
|
* @param id an identifier
|
||||||
* @param lockOptions contains the lock mode
|
* @param lockOptions contains the lock mode
|
||||||
|
*
|
||||||
* @return a persistent instance or null
|
* @return a persistent instance or null
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public Object get(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException;
|
public Object get(String entityName, Serializable id, LockOptions lockOptions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the entity name for a persistent entity
|
* Return the entity name for a persistent entity
|
||||||
*
|
*
|
||||||
* @param object a persistent entity
|
* @param object a persistent entity
|
||||||
|
*
|
||||||
* @return the entity name
|
* @return the entity name
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public String getEntityName(Object object) throws HibernateException;
|
public String getEntityName(Object object);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link IdentifierLoadAccess} instance to retrieve the specified entity type by
|
* Create an {@link IdentifierLoadAccess} instance to retrieve the specified entity type by
|
||||||
|
@ -823,6 +828,7 @@ public interface Session extends SharedSessionContract {
|
||||||
* Enable the named filter for this current session.
|
* Enable the named filter for this current session.
|
||||||
*
|
*
|
||||||
* @param filterName The name of the filter to be enabled.
|
* @param filterName The name of the filter to be enabled.
|
||||||
|
*
|
||||||
* @return The Filter instance representing the enabled filter.
|
* @return The Filter instance representing the enabled filter.
|
||||||
*/
|
*/
|
||||||
public Filter enableFilter(String filterName);
|
public Filter enableFilter(String filterName);
|
||||||
|
@ -831,6 +837,7 @@ public interface Session extends SharedSessionContract {
|
||||||
* Retrieve a currently enabled filter by name.
|
* Retrieve a currently enabled filter by name.
|
||||||
*
|
*
|
||||||
* @param filterName The name of the filter to be retrieved.
|
* @param filterName The name of the filter to be retrieved.
|
||||||
|
*
|
||||||
* @return The Filter instance representing the enabled filter.
|
* @return The Filter instance representing the enabled filter.
|
||||||
*/
|
*/
|
||||||
public Filter getEnabledFilter(String filterName);
|
public Filter getEnabledFilter(String filterName);
|
||||||
|
@ -844,6 +851,8 @@ public interface Session extends SharedSessionContract {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the statistics for this session.
|
* Get the statistics for this session.
|
||||||
|
*
|
||||||
|
* @return The session statistics being collected for this session
|
||||||
*/
|
*/
|
||||||
public SessionStatistics getStatistics();
|
public SessionStatistics getStatistics();
|
||||||
|
|
||||||
|
@ -854,9 +863,8 @@ public interface Session extends SharedSessionContract {
|
||||||
* entities and proxies that are loaded into the session:
|
* entities and proxies that are loaded into the session:
|
||||||
* @see org.hibernate.Session#isDefaultReadOnly()
|
* @see org.hibernate.Session#isDefaultReadOnly()
|
||||||
*
|
*
|
||||||
* @param entityOrProxy, an entity or HibernateProxy
|
* @param entityOrProxy an entity or HibernateProxy
|
||||||
* @return true, the entity or proxy is read-only;
|
* @return {@code true} if the entity or proxy is read-only, {@code false} if the entity or proxy is modifiable.
|
||||||
* false, the entity or proxy is modifiable.
|
|
||||||
*/
|
*/
|
||||||
public boolean isReadOnly(Object entityOrProxy);
|
public boolean isReadOnly(Object entityOrProxy);
|
||||||
|
|
||||||
|
@ -876,15 +884,14 @@ public interface Session extends SharedSessionContract {
|
||||||
* and proxies loaded by a Query:
|
* and proxies loaded by a Query:
|
||||||
* @see Query#setReadOnly(boolean)
|
* @see Query#setReadOnly(boolean)
|
||||||
*
|
*
|
||||||
* @param entityOrProxy, an entity or HibernateProxy
|
* @param entityOrProxy an entity or HibernateProxy
|
||||||
* @param readOnly, if true, the entity or proxy is made read-only;
|
* @param readOnly {@code true} if the entity or proxy should be made read-only; {@code false} if the entity or
|
||||||
* if false, the entity or proxy is made modifiable.
|
* proxy should be made modifiable
|
||||||
*/
|
*/
|
||||||
public void setReadOnly(Object entityOrProxy, boolean readOnly);
|
public void setReadOnly(Object entityOrProxy, boolean readOnly);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for allowing users to perform JDBC related work using the Connection
|
* Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
|
||||||
* managed by this Session.
|
|
||||||
*
|
*
|
||||||
* @param work The work to be performed.
|
* @param work The work to be performed.
|
||||||
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
||||||
|
@ -892,12 +899,13 @@ public interface Session extends SharedSessionContract {
|
||||||
public void doWork(Work work) throws HibernateException;
|
public void doWork(Work work) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for allowing users to perform JDBC related work using the Connection
|
* Controller for allowing users to perform JDBC related work using the Connection managed by this Session. After
|
||||||
* managed by this Session, returning the result from calling <code>work.execute()</code>
|
* execution returns the result of the {@link ReturningWork#execute} call.
|
||||||
* ({@link ReturningWork<T>.execute(Connection)}/
|
|
||||||
*
|
*
|
||||||
* @param work The work to be performed.
|
* @param work The work to be performed.
|
||||||
* @return the result from calling <code>work.execute()</code>.
|
*
|
||||||
|
* @return the result from calling {@link ReturningWork#execute}.
|
||||||
|
*
|
||||||
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
|
||||||
*/
|
*/
|
||||||
public <T> T doReturningWork(ReturningWork<T> work) throws HibernateException;
|
public <T> T doReturningWork(ReturningWork<T> work) throws HibernateException;
|
||||||
|
@ -912,11 +920,11 @@ public interface Session extends SharedSessionContract {
|
||||||
* For non-user-supplied scenarios, normal transaction management already handles disconnection and reconnection
|
* For non-user-supplied scenarios, normal transaction management already handles disconnection and reconnection
|
||||||
* automatically.
|
* automatically.
|
||||||
*
|
*
|
||||||
* @return the application-supplied connection or {@literal null}
|
* @return the application-supplied connection or {@code null}
|
||||||
*
|
*
|
||||||
* @see #reconnect(Connection)
|
* @see #reconnect(Connection)
|
||||||
*/
|
*/
|
||||||
Connection disconnect() throws HibernateException;
|
Connection disconnect();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reconnect to the given JDBC connection.
|
* Reconnect to the given JDBC connection.
|
||||||
|
@ -925,7 +933,7 @@ public interface Session extends SharedSessionContract {
|
||||||
*
|
*
|
||||||
* @see #disconnect()
|
* @see #disconnect()
|
||||||
*/
|
*/
|
||||||
void reconnect(Connection connection) throws HibernateException;
|
void reconnect(Connection connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a particular fetch profile enabled on this session?
|
* Is a particular fetch profile enabled on this session?
|
||||||
|
@ -996,7 +1004,7 @@ public interface Session extends SharedSessionContract {
|
||||||
/**
|
/**
|
||||||
* Specify the LockMode to be used. The default is LockMode.none.
|
* Specify the LockMode to be used. The default is LockMode.none.
|
||||||
*
|
*
|
||||||
* @param lockMode
|
* @param lockMode The lock mode to use for this request
|
||||||
*
|
*
|
||||||
* @return this LockRequest instance for operation chaining.
|
* @return this LockRequest instance for operation chaining.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,7 @@ public interface Transaction {
|
||||||
/**
|
/**
|
||||||
* Is this transaction the initiator of any underlying transaction?
|
* Is this transaction the initiator of any underlying transaction?
|
||||||
*
|
*
|
||||||
* @return {@literal true} if this transaction initiated the underlying transaction; {@literal false} otherwise.
|
* @return {@code true} if this transaction initiated the underlying transaction; {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isInitiator();
|
public boolean isInitiator();
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public interface Transaction {
|
||||||
* transaction is active when it is initiated directly through the JDBC {@link java.sql.Connection}, only when
|
* transaction is active when it is initiated directly through the JDBC {@link java.sql.Connection}, only when
|
||||||
* it is initiated from here.
|
* it is initiated from here.
|
||||||
*
|
*
|
||||||
* @return {@literal true} if the transaction is still active; {@literal false} otherwise.
|
* @return {@code true} if the transaction is still active; {@code false} otherwise.
|
||||||
*
|
*
|
||||||
* @throws HibernateException Indicates a problem checking the transaction status.
|
* @throws HibernateException Indicates a problem checking the transaction status.
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +113,8 @@ public interface Transaction {
|
||||||
* <p/>
|
* <p/>
|
||||||
* Generally speaking this will be the same as {@link #isActive()}.
|
* Generally speaking this will be the same as {@link #isActive()}.
|
||||||
*
|
*
|
||||||
* @return
|
* @return {@code true} if Hibernate is known to be participating in the underlying transaction; {@code false}
|
||||||
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isParticipating();
|
public boolean isParticipating();
|
||||||
|
|
||||||
|
@ -124,10 +125,11 @@ public interface Transaction {
|
||||||
* transaction was committed when the commit was performed directly through the JDBC {@link java.sql.Connection},
|
* transaction was committed when the commit was performed directly through the JDBC {@link java.sql.Connection},
|
||||||
* only when the commit was done from this.
|
* only when the commit was done from this.
|
||||||
*
|
*
|
||||||
* @return {@literal true} if the transaction is rolled back; {@literal false} otherwise.
|
* @return {@code true} if the transaction is rolled back; {@code false} otherwise.
|
||||||
*
|
*
|
||||||
* @throws HibernateException Indicates a problem checking the transaction status.
|
* @throws HibernateException Indicates a problem checking the transaction status.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean wasCommitted();
|
public boolean wasCommitted();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +143,7 @@ public interface Transaction {
|
||||||
*
|
*
|
||||||
* @throws HibernateException Indicates a problem checking the transaction status.
|
* @throws HibernateException Indicates a problem checking the transaction status.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean wasRolledBack();
|
public boolean wasRolledBack();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!--
|
<!--
|
||||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
~
|
~
|
||||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
~ indicated by the @author tags or express copyright attribution
|
~ indicated by the @author tags or express copyright attribution
|
||||||
~ statements applied by the authors. All third-party contributions are
|
~ statements applied by the authors. All third-party contributions are
|
||||||
~ distributed under license by Red Hat Middleware LLC.
|
~ distributed under license by Red Hat Inc.
|
||||||
~
|
~
|
||||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
~ 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
|
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,43 +20,13 @@
|
||||||
~ Free Software Foundation, Inc.
|
~ Free Software Foundation, Inc.
|
||||||
~ 51 Franklin Street, Fifth Floor
|
~ 51 Franklin Street, Fifth Floor
|
||||||
~ Boston, MA 02110-1301 USA
|
~ Boston, MA 02110-1301 USA
|
||||||
~
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
This package defines Hibernate second level cache service. {@link org.hibernate.cache.spi} defines the
|
This package defines API of the Hibernate second level cache service. The
|
||||||
SPI used to integrate with Hibernate internals.
|
<a href="{@docRoot}/org/hibernate/cache/spi">org.hibernate.cache.spi</a> package defines the SPI used to
|
||||||
</p>
|
integrate with Hibernate internals.
|
||||||
<p>
|
|
||||||
The legacy (and now deprecated) approach to caching is defined by the {@link org.hibernate.cache.CacheProvider} and
|
|
||||||
{@link org.hibernate.cache.Cache} interfaces as well as the {@link org.hibernate.cache.CacheConcurrencyStrategy}
|
|
||||||
interface along with the various implementations of all these interfaces. In that scheme, a
|
|
||||||
{@link org.hibernate.cache.CacheProvider} defined how to configure and perform lifecycle operations
|
|
||||||
in regards to a particular underlying caching library; it also defined how to build {@link org.hibernate.cache.Cache}
|
|
||||||
instances which in turn defined how to access the "regions" of the underlying cache instance.
|
|
||||||
For entity and collection data cache regions, {@link org.hibernate.cache.CacheConcurrencyStrategy} wrapped
|
|
||||||
access to those cache regions to apply transactional/concurrent access semantics.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The improved approach is based on {@link org.hibernate.cache.RegionFactory}, the various
|
|
||||||
{@link org.hibernate.cache.Region} specializations and the two access strategies contracts
|
|
||||||
({@link org.hibernate.cache.access.EntityRegionAccessStrategy} and
|
|
||||||
{@link org.hibernate.cache.access.CollectionRegionAccessStrategy}). The general approach here is that
|
|
||||||
{@link org.hibernate.cache.RegionFactory} defined how to configure and perform lifecycle operations
|
|
||||||
in regards to a particular underlying caching library (<b>or libraries</b>).
|
|
||||||
{@link org.hibernate.cache.RegionFactory} also defines how to build specialized
|
|
||||||
{@link org.hibernate.cache.Region} instances based on the type of data we will be storing in that given
|
|
||||||
region. The fact that {@link org.hibernate.cache.RegionFactory} is asked to build <b>specialized</b>
|
|
||||||
regions (as opposed to just general access) is the first <i>improvement</i> over the legacy scheme. The
|
|
||||||
second <i>improvement</i> is the fact that the regions (well the ones like entity and collection regions
|
|
||||||
that are responsible for storing {@link org.hibernate.cache.TransactionalDataRegion transactional} data) are
|
|
||||||
asked to build their own access strategies (see {@link org.hibernate.cache.EntityRegion#buildAccessStrategy}
|
|
||||||
and {@link org.hibernate.cache.CollectionRegion#buildAccessStrategy}).
|
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -34,25 +34,24 @@ public interface CacheDataDescription {
|
||||||
/**
|
/**
|
||||||
* Is the data marked as being mutable?
|
* Is the data marked as being mutable?
|
||||||
*
|
*
|
||||||
* @return True if the data is mutable; false otherwise.
|
* @return {@code true} if the data is mutable; {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isMutable();
|
public boolean isMutable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the data to be cached considered versioned?
|
* Is the data to be cached considered versioned?
|
||||||
* <p/>
|
|
||||||
* If true, it is illegal for {@link #getVersionComparator} to return
|
|
||||||
* null.
|
|
||||||
*
|
*
|
||||||
* @return True if the data is versioned; false otherwise.
|
* If {@code true}, it is illegal for {@link #getVersionComparator} to return {@code null}.
|
||||||
|
*
|
||||||
|
* @return {@code true} if the data is versioned; {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isVersioned();
|
public boolean isVersioned();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the comparator used to compare two different version values.
|
* Get the comparator used to compare two different version values. May return {@code null} <b>if</b>
|
||||||
* <p/>
|
* {@link #isVersioned()} returns false.
|
||||||
* May return null <b>if</b> {@link #isVersioned()} returns false.
|
*
|
||||||
* @return
|
* @return The comparator for versions, or {@code null}
|
||||||
*/
|
*/
|
||||||
public Comparator getVersionComparator();
|
public Comparator getVersionComparator();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
package org.hibernate.cache.spi;
|
package org.hibernate.cache.spi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker interface for identifying {@link Cache} implementations which are aware of JTA transactions
|
* Marker interface for identifying {@link org.hibernate.Cache} implementations which are aware of JTA transactions
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,8 +24,7 @@
|
||||||
package org.hibernate.cache.spi.access;
|
package org.hibernate.cache.spi.access;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moved up from inner definition on the now deprecated
|
* Marker object for use by synchronous concurrency strategies
|
||||||
* {@link org.hibernate.cache.spi.CacheConcurrencyStrategy}.
|
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!--
|
<!--
|
||||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
~
|
~
|
||||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
~ indicated by the @author tags or express copyright attribution
|
~ indicated by the @author tags or express copyright attribution
|
||||||
~ statements applied by the authors. All third-party contributions are
|
~ statements applied by the authors. All third-party contributions are
|
||||||
~ distributed under license by Red Hat Middleware LLC.
|
~ distributed under license by Red Hat Inc.
|
||||||
~
|
~
|
||||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
~ 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
|
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,19 +20,17 @@
|
||||||
~ Free Software Foundation, Inc.
|
~ Free Software Foundation, Inc.
|
||||||
~ 51 Franklin Street, Fifth Floor
|
~ 51 Franklin Street, Fifth Floor
|
||||||
~ Boston, MA 02110-1301 USA
|
~ Boston, MA 02110-1301 USA
|
||||||
~
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head></head>
|
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
Defines contracts for transactional and concurrent access to cached
|
Defines contracts for transactional and concurrent access to cached
|
||||||
{@link org.hibernate.cache.access.EntityRegionAccessStrategy entity} and
|
{@link org.hibernate.cache.spi.access.EntityRegionAccessStrategy entity} and
|
||||||
{@link org.hibernate.cache.access.CollectionRegionAccessStrategy collection} data. Transactions pass in a
|
{@link org.hibernate.cache.spi.access.CollectionRegionAccessStrategy collection} data. Transactions pass in a
|
||||||
timestamp indicating transaction start time which is then used to protect against concurrent access (exactly how
|
timestamp indicating transaction start time which is then used to protect against concurrent access (exactly how
|
||||||
that occurs is based on the actual access-strategy impl used). Two different implementation patterns are provided
|
that occurs is based on the actual access-strategy impl used). Two different implementation patterns are provided
|
||||||
for.
|
for:
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
A transaction-aware cache implementation might be wrapped by a <i>synchronous</i> access strategy,
|
A transaction-aware cache implementation might be wrapped by a <i>synchronous</i> access strategy,
|
||||||
|
@ -45,22 +43,22 @@
|
||||||
item.
|
item.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
The <i>asynchronous</i> access strategies are: {@link org.hibernate.cache.access.AccessType.READ_ONLY read-only},
|
The <i>asynchronous</i> access strategies are: {@link org.hibernate.cache.spi.access.AccessType#READ_ONLY read-only},
|
||||||
{@link org.hibernate.cache.access.AccessType.READ_WRITE read-write} and
|
{@link org.hibernate.cache.spi.access.AccessType#READ_WRITE read-write} and
|
||||||
{@link org.hibernate.cache.access.AccessType.NONSTRICT_READ_WRITE nonstrict-read-write}. The only
|
{@link org.hibernate.cache.spi.access.AccessType#NONSTRICT_READ_WRITE nonstrict-read-write}. The only
|
||||||
<i>synchronous</i> access strategy is {@link org.hibernate.cache.access.AccessType.TRANSACTIONAL transactional}.
|
<i>synchronous</i> access strategy is {@link org.hibernate.cache.spi.access.AccessType#TRANSACTIONAL transactional}.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Note that, for an <i>asynchronous</i> cache, cache invalidation must be a two step process (lock->unlock or
|
Note that, for an <i>asynchronous</i> cache, cache invalidation must be a two step process (lock->unlock or
|
||||||
lock->afterUpdate), since this is the only way to guarantee consistency with the database for a nontransactional
|
lock->afterUpdate), since this is the only way to guarantee consistency with the database for a nontransactional
|
||||||
cache implementation. For a <i>synchronous</i> cache, cache invalidation is a single step process (evict or update).
|
cache implementation. For a <i>synchronous</i> cache, cache invalidation is a single step process (evict or update).
|
||||||
Hence, these contracts ({@link org.hibernate.cache.access.EntityRegionAcessStrategy} and
|
Hence, these contracts ({@link org.hibernate.cache.spi.access.EntityRegionAccessStrategy} and
|
||||||
{@link org.hibernate.cache.access.CollectionRegionAccessStrategy}) define a three step process to cater for both
|
{@link org.hibernate.cache.spi.access.CollectionRegionAccessStrategy}) define a three step process to cater for both
|
||||||
models (see the individual contracts for details).
|
models (see the individual contracts for details).
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Note that query result caching does not go through an access strategy; those caches are managed directly against
|
Note that query result caching does not go through an access strategy; those caches are managed directly against
|
||||||
the underlying {@link org.hibernate.cache.QueryResultsRegion}.
|
the underlying {@link org.hibernate.cache.spi.QueryResultsRegion}.
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!--
|
<!--
|
||||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
~
|
~
|
||||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
~ indicated by the @author tags or express copyright attribution
|
~ indicated by the @author tags or express copyright attribution
|
||||||
~ statements applied by the authors. All third-party contributions are
|
~ statements applied by the authors. All third-party contributions are
|
||||||
~ distributed under license by Red Hat Middleware LLC.
|
~ distributed under license by Red Hat Inc.
|
||||||
~
|
~
|
||||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
~ 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
|
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,16 +20,12 @@
|
||||||
~ Free Software Foundation, Inc.
|
~ Free Software Foundation, Inc.
|
||||||
~ 51 Franklin Street, Fifth Floor
|
~ 51 Franklin Street, Fifth Floor
|
||||||
~ Boston, MA 02110-1301 USA
|
~ Boston, MA 02110-1301 USA
|
||||||
~
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
This package defines formats for disassembled state
|
This package defines formats for disassembled state kept in the second level cache.
|
||||||
kept in the second level cache.
|
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<!--
|
||||||
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
~
|
||||||
|
~ Copyright (c) 2011, Red Hat Inc. 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 Inc.
|
||||||
|
~
|
||||||
|
~ 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
|
||||||
|
-->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Defines the Hibernate second level caching SPI.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The initial contract here is {@link org.hibernate.cache.spi.RegionFactory} whose implementations are
|
||||||
|
responsible for configuring and managing lifecycle operations in regards to the particular underlying
|
||||||
|
caching library. Its other main purpose is to build specializations {@link org.hibernate.cache.spi.Region}
|
||||||
|
instances based on the type of data we will be storing in that given region.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -168,6 +168,7 @@ import org.hibernate.usertype.UserType;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @see org.hibernate.SessionFactory
|
* @see org.hibernate.SessionFactory
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public class Configuration implements Serializable {
|
public class Configuration implements Serializable {
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Configuration.class.getName());
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Configuration.class.getName());
|
||||||
|
@ -1507,9 +1508,7 @@ public class Configuration implements Serializable {
|
||||||
RuntimeException originalException = null;
|
RuntimeException originalException = null;
|
||||||
while ( !stopProcess ) {
|
while ( !stopProcess ) {
|
||||||
List<FkSecondPass> failingSecondPasses = new ArrayList<FkSecondPass>();
|
List<FkSecondPass> failingSecondPasses = new ArrayList<FkSecondPass>();
|
||||||
Iterator<FkSecondPass> it = endOfQueueFkSecondPasses.listIterator();
|
for ( FkSecondPass pass : endOfQueueFkSecondPasses ) {
|
||||||
while ( it.hasNext() ) {
|
|
||||||
final FkSecondPass pass = it.next();
|
|
||||||
try {
|
try {
|
||||||
pass.doSecondPass( classes );
|
pass.doSecondPass( classes );
|
||||||
}
|
}
|
||||||
|
@ -1621,7 +1620,7 @@ public class Configuration implements Serializable {
|
||||||
LOG.debug( "Processing foreign key constraints" );
|
LOG.debug( "Processing foreign key constraints" );
|
||||||
|
|
||||||
itr = getTableMappings();
|
itr = getTableMappings();
|
||||||
Set done = new HashSet();
|
Set<ForeignKey> done = new HashSet<ForeignKey>();
|
||||||
while ( itr.hasNext() ) {
|
while ( itr.hasNext() ) {
|
||||||
secondPassCompileForeignKeys( (Table) itr.next(), done );
|
secondPassCompileForeignKeys( (Table) itr.next(), done );
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1638,7 @@ public class Configuration implements Serializable {
|
||||||
|
|
||||||
if ( extendsQueue.size() > 0 ) {
|
if ( extendsQueue.size() > 0 ) {
|
||||||
Iterator iterator = extendsQueue.keySet().iterator();
|
Iterator iterator = extendsQueue.keySet().iterator();
|
||||||
StringBuffer buf = new StringBuffer( "Following super classes referenced in extends not found: " );
|
StringBuilder buf = new StringBuilder( "Following super classes referenced in extends not found: " );
|
||||||
while ( iterator.hasNext() ) {
|
while ( iterator.hasNext() ) {
|
||||||
final ExtendsQueueEntry entry = ( ExtendsQueueEntry ) iterator.next();
|
final ExtendsQueueEntry entry = ( ExtendsQueueEntry ) iterator.next();
|
||||||
buf.append( entry.getExplicitName() );
|
buf.append( entry.getExplicitName() );
|
||||||
|
@ -1670,7 +1669,7 @@ public class Configuration implements Serializable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void secondPassCompileForeignKeys(Table table, Set done) throws MappingException {
|
protected void secondPassCompileForeignKeys(Table table, Set<ForeignKey> done) throws MappingException {
|
||||||
table.createForeignKeys();
|
table.createForeignKeys();
|
||||||
Iterator iter = table.getForeignKeyIterator();
|
Iterator iter = table.getForeignKeyIterator();
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() ) {
|
||||||
|
@ -1714,7 +1713,9 @@ public class Configuration implements Serializable {
|
||||||
* {@link SessionFactory} will be immutable, so changes made to {@code this} {@link Configuration} after
|
* {@link SessionFactory} will be immutable, so changes made to {@code this} {@link Configuration} after
|
||||||
* building the {@link SessionFactory} will not affect it.
|
* building the {@link SessionFactory} will not affect it.
|
||||||
*
|
*
|
||||||
* @return The build {@link SessionFactory}
|
* @param serviceRegistry The registry of services to be used in creating this session factory.
|
||||||
|
*
|
||||||
|
* @return The built {@link SessionFactory}
|
||||||
*
|
*
|
||||||
* @throws HibernateException usually indicates an invalid configuration or invalid mapping information
|
* @throws HibernateException usually indicates an invalid configuration or invalid mapping information
|
||||||
*/
|
*/
|
||||||
|
@ -1776,7 +1777,7 @@ public class Configuration implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rterieve the configured {@link Interceptor}.
|
* Retrieve the configured {@link Interceptor}.
|
||||||
*
|
*
|
||||||
* @return The current {@link Interceptor}
|
* @return The current {@link Interceptor}
|
||||||
*/
|
*/
|
||||||
|
@ -1787,7 +1788,7 @@ public class Configuration implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Set the current {@link Interceptor}
|
* Set the current {@link Interceptor}
|
||||||
*
|
*
|
||||||
* @param interceptor The {@link Interceptor} to use for the {@link #buildSessionFactory) built}
|
* @param interceptor The {@link Interceptor} to use for the {@link #buildSessionFactory built}
|
||||||
* {@link SessionFactory}.
|
* {@link SessionFactory}.
|
||||||
*
|
*
|
||||||
* @return this for method chaining
|
* @return this for method chaining
|
||||||
|
@ -2226,8 +2227,6 @@ public class Configuration implements Serializable {
|
||||||
* @param collectionRole The name of the collection to which we should associate these cache settings
|
* @param collectionRole The name of the collection to which we should associate these cache settings
|
||||||
* @param concurrencyStrategy The cache strategy to use
|
* @param concurrencyStrategy The cache strategy to use
|
||||||
* @param region The name of the cache region to use
|
* @param region The name of the cache region to use
|
||||||
*
|
|
||||||
* @return this for method chaining
|
|
||||||
*/
|
*/
|
||||||
public void setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy, String region) {
|
public void setCollectionCacheConcurrencyStrategy(String collectionRole, String concurrencyStrategy, String region) {
|
||||||
caches.add( new CacheHolder( collectionRole, concurrencyStrategy, region, false, false ) );
|
caches.add( new CacheHolder( collectionRole, concurrencyStrategy, region, false, false ) );
|
||||||
|
@ -2254,6 +2253,8 @@ public class Configuration implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Create an object-oriented view of the configuration properties
|
* Create an object-oriented view of the configuration properties
|
||||||
*
|
*
|
||||||
|
* @param serviceRegistry The registry of services to be used in building these settings.
|
||||||
|
*
|
||||||
* @return The build settings
|
* @return The build settings
|
||||||
*/
|
*/
|
||||||
public Settings buildSettings(ServiceRegistry serviceRegistry) {
|
public Settings buildSettings(ServiceRegistry serviceRegistry) {
|
||||||
|
@ -2442,6 +2443,7 @@ public class Configuration implements Serializable {
|
||||||
* Internal implementation of the Mappings interface giving access to the Configuration's internal
|
* Internal implementation of the Mappings interface giving access to the Configuration's internal
|
||||||
* <tt>metadata repository</tt> state ({@link Configuration#classes}, {@link Configuration#tables}, etc).
|
* <tt>metadata repository</tt> state ({@link Configuration#classes}, {@link Configuration#tables}, etc).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"deprecation", "unchecked"})
|
||||||
protected class MappingsImpl implements ExtendedMappings, Serializable {
|
protected class MappingsImpl implements ExtendedMappings, Serializable {
|
||||||
|
|
||||||
private String schemaName;
|
private String schemaName;
|
||||||
|
@ -2824,7 +2826,7 @@ public class Configuration implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildTableNameKey(String schema, String catalog, String finalName) {
|
private String buildTableNameKey(String schema, String catalog, String finalName) {
|
||||||
StringBuffer keyBuilder = new StringBuffer();
|
StringBuilder keyBuilder = new StringBuilder();
|
||||||
if (schema != null) keyBuilder.append( schema );
|
if (schema != null) keyBuilder.append( schema );
|
||||||
keyBuilder.append( ".");
|
keyBuilder.append( ".");
|
||||||
if (catalog != null) keyBuilder.append( catalog );
|
if (catalog != null) keyBuilder.append( catalog );
|
||||||
|
|
|
@ -259,18 +259,6 @@ public class TableBinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param schema
|
|
||||||
* @param catalog
|
|
||||||
* @param realTableName
|
|
||||||
* @param logicalName
|
|
||||||
* @param isAbstract
|
|
||||||
* @param uniqueConstraints
|
|
||||||
* @param constraints
|
|
||||||
* @param denormalizedSuperTable
|
|
||||||
* @param mappings
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #buildAndFillTable} instead.
|
* @deprecated Use {@link #buildAndFillTable} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* 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
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,21 +20,21 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.criterion;
|
package org.hibernate.criterion;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory class for criterion instances that represent expressions
|
* Factory class for criterion instances that represent expressions
|
||||||
* involving subqueries.
|
* involving subqueries.
|
||||||
*
|
*
|
||||||
* @see Restriction
|
* @see Restrictions
|
||||||
* @see Projection
|
* @see Projection
|
||||||
* @see org.hibernate.Criteria
|
* @see org.hibernate.Criteria
|
||||||
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
* @author Lukasz Antoniak (lukasz dot antoniak at gmail dot com)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public class Subqueries {
|
public class Subqueries {
|
||||||
|
|
||||||
public static Criterion exists(DetachedCriteria dc) {
|
public static Criterion exists(DetachedCriteria dc) {
|
||||||
|
|
|
@ -337,20 +337,20 @@ public abstract class Dialect {
|
||||||
/**
|
/**
|
||||||
* Allows the dialect to override a {@link SqlTypeDescriptor}.
|
* Allows the dialect to override a {@link SqlTypeDescriptor}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* If <code>sqlTypeDescriptor</code> is a "standard basic" SQL type
|
* If the passed {@code sqlTypeDescriptor} allows itself to be remapped (per
|
||||||
* descriptor, then this method uses {@link #getSqlTypeDescriptorOverride}
|
* {@link org.hibernate.type.descriptor.sql.SqlTypeDescriptor#canBeRemapped()}), then this method uses
|
||||||
* to get an optional override based on the SQL code returned by
|
* {@link #getSqlTypeDescriptorOverride} to get an optional override based on the SQL code returned by
|
||||||
* {@link SqlTypeDescriptor#getSqlType()}.
|
* {@link SqlTypeDescriptor#getSqlType()}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* If this dialect does not provide an override, then this method
|
* If this dialect does not provide an override or if the {@code sqlTypeDescriptor} doe not allow itself to be
|
||||||
* simply returns <code>sqlTypeDescriptor</code>
|
* remapped, then this method simply returns the original passed {@code sqlTypeDescriptor}
|
||||||
*
|
*
|
||||||
* @param sqlTypeDescriptor The {@link SqlTypeDescriptor} to override
|
* @param sqlTypeDescriptor The {@link SqlTypeDescriptor} to override
|
||||||
* @return The {@link SqlTypeDescriptor} that should be used for this dialect;
|
* @return The {@link SqlTypeDescriptor} that should be used for this dialect;
|
||||||
* if there is no override, then <code>sqlTypeDescriptor</code> is returned.
|
* if there is no override, then original {@code sqlTypeDescriptor} is returned.
|
||||||
* @throws IllegalArgumentException if <code>sqlTypeDescriptor</code> is null.
|
* @throws IllegalArgumentException if {@code sqlTypeDescriptor} is null.
|
||||||
*
|
*
|
||||||
* @see {@link #getSqlTypeDescriptorOverride}
|
* @see #getSqlTypeDescriptorOverride
|
||||||
*/
|
*/
|
||||||
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
|
||||||
if ( sqlTypeDescriptor == null ) {
|
if ( sqlTypeDescriptor == null ) {
|
||||||
|
@ -365,13 +365,11 @@ public abstract class Dialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link SqlTypeDescriptor} that should override the
|
* Returns the {@link SqlTypeDescriptor} that should be used to handle the given JDBC type code. Returns
|
||||||
* "standard basic" SQL type descriptor for values of the specified
|
* {@code null} if there is no override.
|
||||||
* column type, or null, if there is no override.
|
|
||||||
*
|
*
|
||||||
* @param sqlCode A {@link Types} constant indicating the SQL column type
|
* @param sqlCode A {@link Types} constant indicating the SQL column type
|
||||||
* @return The {@link SqlTypeDescriptor} that should override the
|
* @return The {@link SqlTypeDescriptor} to use as an override, or {@code null} if there is no override.
|
||||||
* "standard basic" SQL type descriptor, or null, if there is no override.
|
|
||||||
*/
|
*/
|
||||||
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
|
||||||
SqlTypeDescriptor descriptor;
|
SqlTypeDescriptor descriptor;
|
||||||
|
@ -395,6 +393,7 @@ public abstract class Dialect {
|
||||||
/**
|
/**
|
||||||
* The legacy behavior of Hibernate. LOBs are not processed by merge
|
* The legacy behavior of Hibernate. LOBs are not processed by merge
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
|
protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
|
||||||
@Override
|
@Override
|
||||||
public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
|
public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
|
||||||
|
@ -415,6 +414,7 @@ public abstract class Dialect {
|
||||||
/**
|
/**
|
||||||
* Merge strategy based on transferring contents based on streams.
|
* Merge strategy based on transferring contents based on streams.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
protected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
|
protected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY = new LobMergeStrategy() {
|
||||||
@Override
|
@Override
|
||||||
public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
|
public Blob mergeBlob(Blob original, Blob target, SessionImplementor session) {
|
||||||
|
@ -539,6 +539,7 @@ public abstract class Dialect {
|
||||||
* @return The Hibernate {@link org.hibernate.type.Type} name.
|
* @return The Hibernate {@link org.hibernate.type.Type} name.
|
||||||
* @throws HibernateException If no mapping was specified for that type.
|
* @throws HibernateException If no mapping was specified for that type.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public String getHibernateTypeName(int code) throws HibernateException {
|
public String getHibernateTypeName(int code) throws HibernateException {
|
||||||
String result = hibernateTypeNames.get( code );
|
String result = hibernateTypeNames.get( code );
|
||||||
if ( result == null ) {
|
if ( result == null ) {
|
||||||
|
@ -1046,8 +1047,8 @@ public abstract class Dialect {
|
||||||
* Dialect a chance to convert that value based on what the underlying db or driver will expect.
|
* Dialect a chance to convert that value based on what the underlying db or driver will expect.
|
||||||
* <p/>
|
* <p/>
|
||||||
* NOTE: what gets passed into {@link #getLimitString(String,int,int)} is the zero-based offset. Dialects which
|
* NOTE: what gets passed into {@link #getLimitString(String,int,int)} is the zero-based offset. Dialects which
|
||||||
* do not {@link #supportsVariableLimit} should take care to perform any needed {@link #convertToFirstRowValue}
|
* do not {@link #supportsVariableLimit} should take care to perform any needed first-row-conversion calls prior
|
||||||
* calls prior to injecting the limit values into the SQL string.
|
* to injecting the limit values into the SQL string.
|
||||||
*
|
*
|
||||||
* @param zeroBasedFirstResult The user-supplied, zero-based first row offset.
|
* @param zeroBasedFirstResult The user-supplied, zero-based first row offset.
|
||||||
*
|
*
|
||||||
|
@ -1128,6 +1129,7 @@ public abstract class Dialect {
|
||||||
return getForUpdateString( lockMode, lockOptions.getTimeOut() );
|
return getForUpdateString( lockMode, lockOptions.getTimeOut() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"deprecation"})
|
||||||
private String getForUpdateString(LockMode lockMode, int timeout){
|
private String getForUpdateString(LockMode lockMode, int timeout){
|
||||||
switch ( lockMode ) {
|
switch ( lockMode ) {
|
||||||
case UPGRADE:
|
case UPGRADE:
|
||||||
|
@ -2171,6 +2173,7 @@ public abstract class Dialect {
|
||||||
* @return Returns {@code true} if the database supports accepting bind params as args, {@code false} otherwise. The
|
* @return Returns {@code true} if the database supports accepting bind params as args, {@code false} otherwise. The
|
||||||
* default is {@code true}.
|
* default is {@code true}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean supportsBindAsCallableArgument() {
|
public boolean supportsBindAsCallableArgument() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,7 @@ import org.hibernate.sql.CaseFragment;
|
||||||
/**
|
/**
|
||||||
* A dialect for Oracle 9i databases.
|
* A dialect for Oracle 9i databases.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Unlike the older (deprecated) {@link Oracle9Dialect), this version specifies
|
* Specifies to not use "ANSI join syntax" because 9i does not seem to properly handle it in all cases.
|
||||||
* to not use "ANSI join syntax" because 9i does not seem to properly
|
|
||||||
* handle it in all cases.
|
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +65,7 @@ public class Oracle9iDialect extends Oracle8iDialect {
|
||||||
isForUpdate = true;
|
isForUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer pagingSelect = new StringBuffer( sql.length()+100 );
|
StringBuilder pagingSelect = new StringBuilder( sql.length() + 100 );
|
||||||
if (hasOffset) {
|
if (hasOffset) {
|
||||||
pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
|
pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,8 +143,7 @@ public class SQLServer2005Dialect extends SQLServerDialect {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that checks if the given sql query is a select distinct one and if so replaces the distinct select
|
* Utility method that checks if the given sql query is a select distinct one and if so replaces the distinct select
|
||||||
* with an equivalent simple select with a group by clause. See
|
* with an equivalent simple select with a group by clause.
|
||||||
* {@link SQLServer2005DialectTestCase#testReplaceDistinctWithGroupBy()}
|
|
||||||
*
|
*
|
||||||
* @param sql an sql query
|
* @param sql an sql query
|
||||||
*/
|
*/
|
||||||
|
@ -158,7 +157,7 @@ public class SQLServer2005Dialect extends SQLServerDialect {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This utility method searches the given sql query for the fields of the select statement and returns them without
|
* This utility method searches the given sql query for the fields of the select statement and returns them without
|
||||||
* the aliases. See {@link SQLServer2005DialectTestCase#testGetSelectFieldsWithoutAliases()}
|
* the aliases.
|
||||||
*
|
*
|
||||||
* @param sql sql query
|
* @param sql sql query
|
||||||
*
|
*
|
||||||
|
@ -172,7 +171,7 @@ public class SQLServer2005Dialect extends SQLServerDialect {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method that strips the aliases. See {@link SQLServer2005DialectTestCase#testStripAliases()}
|
* Utility method that strips the aliases.
|
||||||
*
|
*
|
||||||
* @param str string to replace the as statements
|
* @param str string to replace the as statements
|
||||||
*
|
*
|
||||||
|
|
|
@ -72,23 +72,21 @@ import org.hibernate.proxy.LazyInitializer;
|
||||||
import org.hibernate.tuple.ElementWrapper;
|
import org.hibernate.tuple.ElementWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A <tt>PersistenceContext</tt> represents the state of persistent "stuff" which
|
* A <strong>stateful</strong> implementation of the {@link PersistenceContext} contract meaning that we maintain this
|
||||||
* Hibernate is tracking. This includes persistent entities, collections,
|
* state throughout the life of the persistence context.
|
||||||
* as well as proxies generated.
|
|
||||||
* </p>
|
* </p>
|
||||||
* There is meant to be a one-to-one correspondence between a SessionImpl and
|
* IMPL NOTE: There is meant to be a one-to-one correspondence between a {@link org.hibernate.internal.SessionImpl}
|
||||||
* a PersistentContext. The SessionImpl uses the PersistentContext to track
|
* and a PersistentContext. Event listeners and other Session collaborators then use the PersistentContext to drive
|
||||||
* the current state of its context. Event-listeners then use the
|
* their processing.
|
||||||
* PersistentContext to drive their processing.
|
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class StatefulPersistenceContext implements PersistenceContext {
|
public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
public static final Object NO_ROW = new MarkerObject( "NO_ROW" );
|
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, StatefulPersistenceContext.class.getName() );
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, StatefulPersistenceContext.class.getName() );
|
||||||
|
|
||||||
|
public static final Object NO_ROW = new MarkerObject( "NO_ROW" );
|
||||||
|
|
||||||
private static final int INIT_COLL_SIZE = 8;
|
private static final int INIT_COLL_SIZE = 8;
|
||||||
|
|
||||||
private SessionImplementor session;
|
private SessionImplementor session;
|
||||||
|
@ -134,7 +132,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
// Parent entities cache by their child for cascading
|
// Parent entities cache by their child for cascading
|
||||||
// May be empty or not contains all relation
|
// May be empty or not contains all relation
|
||||||
private Map parentsByChild;
|
private Map<Object,Object> parentsByChild;
|
||||||
|
|
||||||
private int cascading = 0;
|
private int cascading = 0;
|
||||||
private int loadCounter = 0;
|
private int loadCounter = 0;
|
||||||
|
@ -156,36 +154,40 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
public StatefulPersistenceContext(SessionImplementor session) {
|
public StatefulPersistenceContext(SessionImplementor session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
|
|
||||||
entitiesByKey = new HashMap( INIT_COLL_SIZE );
|
entitiesByKey = new HashMap<EntityKey, Object>( INIT_COLL_SIZE );
|
||||||
entitiesByUniqueKey = new HashMap( INIT_COLL_SIZE );
|
entitiesByUniqueKey = new HashMap<EntityUniqueKey, Object>( INIT_COLL_SIZE );
|
||||||
proxiesByKey = new ReferenceMap( AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK );
|
//noinspection unchecked
|
||||||
entitySnapshotsByKey = new HashMap( INIT_COLL_SIZE );
|
proxiesByKey = (Map<EntityKey, Object>) new ReferenceMap( AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK );
|
||||||
|
entitySnapshotsByKey = new HashMap<EntityKey, Object>( INIT_COLL_SIZE );
|
||||||
|
|
||||||
entityEntries = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
|
entityEntries = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
|
||||||
collectionEntries = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
|
collectionEntries = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
|
||||||
parentsByChild = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
|
parentsByChild = IdentityMap.instantiateSequenced( INIT_COLL_SIZE );
|
||||||
|
|
||||||
collectionsByKey = new HashMap( INIT_COLL_SIZE );
|
collectionsByKey = new HashMap<CollectionKey, PersistentCollection>( INIT_COLL_SIZE );
|
||||||
arrayHolders = new IdentityHashMap<Object, PersistentCollection>( INIT_COLL_SIZE );
|
arrayHolders = new IdentityHashMap<Object, PersistentCollection>( INIT_COLL_SIZE );
|
||||||
|
|
||||||
nullifiableEntityKeys = new HashSet();
|
nullifiableEntityKeys = new HashSet<EntityKey>();
|
||||||
|
|
||||||
initTransientState();
|
initTransientState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTransientState() {
|
private void initTransientState() {
|
||||||
nullAssociations = new HashSet( INIT_COLL_SIZE );
|
nullAssociations = new HashSet<AssociationKey>( INIT_COLL_SIZE );
|
||||||
nonlazyCollections = new ArrayList( INIT_COLL_SIZE );
|
nonlazyCollections = new ArrayList<PersistentCollection>( INIT_COLL_SIZE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isStateless() {
|
public boolean isStateless() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SessionImplementor getSession() {
|
public SessionImplementor getSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LoadContexts getLoadContexts() {
|
public LoadContexts getLoadContexts() {
|
||||||
if ( loadContexts == null ) {
|
if ( loadContexts == null ) {
|
||||||
loadContexts = new LoadContexts( this );
|
loadContexts = new LoadContexts( this );
|
||||||
|
@ -193,6 +195,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return loadContexts;
|
return loadContexts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addUnownedCollection(CollectionKey key, PersistentCollection collection) {
|
public void addUnownedCollection(CollectionKey key, PersistentCollection collection) {
|
||||||
if (unownedCollections==null) {
|
if (unownedCollections==null) {
|
||||||
unownedCollections = new HashMap<CollectionKey,PersistentCollection>(8);
|
unownedCollections = new HashMap<CollectionKey,PersistentCollection>(8);
|
||||||
|
@ -200,6 +203,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
unownedCollections.put( key, collection );
|
unownedCollections.put( key, collection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PersistentCollection useUnownedCollection(CollectionKey key) {
|
public PersistentCollection useUnownedCollection(CollectionKey key) {
|
||||||
if ( unownedCollections == null ) {
|
if ( unownedCollections == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -209,10 +213,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Get the <tt>BatchFetchQueue</tt>, instantiating one if
|
|
||||||
* necessary.
|
|
||||||
*/
|
|
||||||
public BatchFetchQueue getBatchFetchQueue() {
|
public BatchFetchQueue getBatchFetchQueue() {
|
||||||
if (batchFetchQueue==null) {
|
if (batchFetchQueue==null) {
|
||||||
batchFetchQueue = new BatchFetchQueue(this);
|
batchFetchQueue = new BatchFetchQueue(this);
|
||||||
|
@ -220,6 +221,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return batchFetchQueue;
|
return batchFetchQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
for ( Object o : proxiesByKey.values() ) {
|
for ( Object o : proxiesByKey.values() ) {
|
||||||
final LazyInitializer li = ((HibernateProxy) o).getHibernateLazyInitializer();
|
final LazyInitializer li = ((HibernateProxy) o).getHibernateLazyInitializer();
|
||||||
|
@ -251,24 +253,22 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isDefaultReadOnly() {
|
public boolean isDefaultReadOnly() {
|
||||||
return defaultReadOnly;
|
return defaultReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setDefaultReadOnly(boolean defaultReadOnly) {
|
public void setDefaultReadOnly(boolean defaultReadOnly) {
|
||||||
this.defaultReadOnly = defaultReadOnly;
|
this.defaultReadOnly = defaultReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNonReadOnlyEntities() {
|
public boolean hasNonReadOnlyEntities() {
|
||||||
return hasNonReadOnlyEntities;
|
return hasNonReadOnlyEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setEntryStatus(EntityEntry entry, Status status) {
|
public void setEntryStatus(EntityEntry entry, Status status) {
|
||||||
entry.setStatus(status);
|
entry.setStatus(status);
|
||||||
setHasNonReadOnlyEnties(status);
|
setHasNonReadOnlyEnties(status);
|
||||||
|
@ -280,6 +280,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterTransactionCompletion() {
|
public void afterTransactionCompletion() {
|
||||||
cleanUpInsertedKeysAfterTransaction();
|
cleanUpInsertedKeysAfterTransaction();
|
||||||
// Downgrade locks
|
// Downgrade locks
|
||||||
|
@ -292,6 +293,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Get the current state of the entity as known to the underlying
|
* Get the current state of the entity as known to the underlying
|
||||||
* database, or null if there is no corresponding row
|
* database, or null if there is no corresponding row
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister)
|
public Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
final EntityKey key = session.generateEntityKey( id, persister );
|
final EntityKey key = session.generateEntityKey( id, persister );
|
||||||
|
@ -306,6 +308,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister)
|
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
if ( !persister.hasNaturalIdentifier() ) {
|
if ( !persister.hasNaturalIdentifier() ) {
|
||||||
|
@ -317,8 +320,8 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
int[] props = persister.getNaturalIdentifierProperties();
|
int[] props = persister.getNaturalIdentifierProperties();
|
||||||
boolean[] updateable = persister.getPropertyUpdateability();
|
boolean[] updateable = persister.getPropertyUpdateability();
|
||||||
boolean allNatualIdPropsAreUpdateable = true;
|
boolean allNatualIdPropsAreUpdateable = true;
|
||||||
for ( int i = 0; i < props.length; i++ ) {
|
for ( int prop : props ) {
|
||||||
if ( !updateable[ props[i] ] ) {
|
if ( !updateable[prop] ) {
|
||||||
allNatualIdPropsAreUpdateable = false;
|
allNatualIdPropsAreUpdateable = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,6 +357,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @return The cached snapshot
|
* @return The cached snapshot
|
||||||
* @throws IllegalStateException if the cached snapshot was == {@link #NO_ROW}.
|
* @throws IllegalStateException if the cached snapshot was == {@link #NO_ROW}.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object[] getCachedDatabaseSnapshot(EntityKey key) {
|
public Object[] getCachedDatabaseSnapshot(EntityKey key) {
|
||||||
Object snapshot = entitySnapshotsByKey.get( key );
|
Object snapshot = entitySnapshotsByKey.get( key );
|
||||||
if ( snapshot == NO_ROW ) {
|
if ( snapshot == NO_ROW ) {
|
||||||
|
@ -362,10 +366,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return ( Object[] ) snapshot;
|
return ( Object[] ) snapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void removeDatabaseSnapshot(EntityKey key) {
|
@Override
|
||||||
entitySnapshotsByKey.remove(key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void addEntity(EntityKey key, Object entity) {
|
public void addEntity(EntityKey key, Object entity) {
|
||||||
entitiesByKey.put(key, entity);
|
entitiesByKey.put(key, entity);
|
||||||
getBatchFetchQueue().removeBatchLoadableEntityKey(key);
|
getBatchFetchQueue().removeBatchLoadableEntityKey(key);
|
||||||
|
@ -375,10 +376,12 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Get the entity instance associated with the given
|
* Get the entity instance associated with the given
|
||||||
* <tt>EntityKey</tt>
|
* <tt>EntityKey</tt>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getEntity(EntityKey key) {
|
public Object getEntity(EntityKey key) {
|
||||||
return entitiesByKey.get(key);
|
return entitiesByKey.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean containsEntity(EntityKey key) {
|
public boolean containsEntity(EntityKey key) {
|
||||||
return entitiesByKey.containsKey(key);
|
return entitiesByKey.containsKey(key);
|
||||||
}
|
}
|
||||||
|
@ -388,6 +391,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* up other state associated with the entity, all except
|
* up other state associated with the entity, all except
|
||||||
* for the <tt>EntityEntry</tt>
|
* for the <tt>EntityEntry</tt>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object removeEntity(EntityKey key) {
|
public Object removeEntity(EntityKey key) {
|
||||||
Object entity = entitiesByKey.remove(key);
|
Object entity = entitiesByKey.remove(key);
|
||||||
Iterator iter = entitiesByUniqueKey.values().iterator();
|
Iterator iter = entitiesByUniqueKey.values().iterator();
|
||||||
|
@ -406,6 +410,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get an entity cached by unique key
|
* Get an entity cached by unique key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getEntity(EntityUniqueKey euk) {
|
public Object getEntity(EntityUniqueKey euk) {
|
||||||
return entitiesByUniqueKey.get(euk);
|
return entitiesByUniqueKey.get(euk);
|
||||||
}
|
}
|
||||||
|
@ -413,6 +418,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Add an entity to the cache by unique key
|
* Add an entity to the cache by unique key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addEntity(EntityUniqueKey euk, Object entity) {
|
public void addEntity(EntityUniqueKey euk, Object entity) {
|
||||||
entitiesByUniqueKey.put(euk, entity);
|
entitiesByUniqueKey.put(euk, entity);
|
||||||
}
|
}
|
||||||
|
@ -423,6 +429,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @param entity The entity for which to locate the EntityEntry.
|
* @param entity The entity for which to locate the EntityEntry.
|
||||||
* @return The EntityEntry for the given entity.
|
* @return The EntityEntry for the given entity.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public EntityEntry getEntry(Object entity) {
|
public EntityEntry getEntry(Object entity) {
|
||||||
return entityEntries.get(entity);
|
return entityEntries.get(entity);
|
||||||
}
|
}
|
||||||
|
@ -430,6 +437,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Remove an entity entry from the session cache
|
* Remove an entity entry from the session cache
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public EntityEntry removeEntry(Object entity) {
|
public EntityEntry removeEntry(Object entity) {
|
||||||
return entityEntries.remove(entity);
|
return entityEntries.remove(entity);
|
||||||
}
|
}
|
||||||
|
@ -437,6 +445,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Is there an EntityEntry for this instance?
|
* Is there an EntityEntry for this instance?
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isEntryFor(Object entity) {
|
public boolean isEntryFor(Object entity) {
|
||||||
return entityEntries.containsKey(entity);
|
return entityEntries.containsKey(entity);
|
||||||
}
|
}
|
||||||
|
@ -444,6 +453,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get the collection entry for a persistent collection
|
* Get the collection entry for a persistent collection
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public CollectionEntry getCollectionEntry(PersistentCollection coll) {
|
public CollectionEntry getCollectionEntry(PersistentCollection coll) {
|
||||||
return collectionEntries.get(coll);
|
return collectionEntries.get(coll);
|
||||||
}
|
}
|
||||||
|
@ -451,6 +461,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Adds an entity to the internal caches.
|
* Adds an entity to the internal caches.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public EntityEntry addEntity(
|
public EntityEntry addEntity(
|
||||||
final Object entity,
|
final Object entity,
|
||||||
final Status status,
|
final Status status,
|
||||||
|
@ -461,11 +472,8 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
final boolean existsInDatabase,
|
final boolean existsInDatabase,
|
||||||
final EntityPersister persister,
|
final EntityPersister persister,
|
||||||
final boolean disableVersionIncrement,
|
final boolean disableVersionIncrement,
|
||||||
boolean lazyPropertiesAreUnfetched
|
boolean lazyPropertiesAreUnfetched) {
|
||||||
) {
|
|
||||||
|
|
||||||
addEntity( entityKey, entity );
|
addEntity( entityKey, entity );
|
||||||
|
|
||||||
return addEntry(
|
return addEntry(
|
||||||
entity,
|
entity,
|
||||||
status,
|
status,
|
||||||
|
@ -486,6 +494,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Generates an appropriate EntityEntry instance and adds it
|
* Generates an appropriate EntityEntry instance and adds it
|
||||||
* to the event source's internal caches.
|
* to the event source's internal caches.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public EntityEntry addEntry(
|
public EntityEntry addEntry(
|
||||||
final Object entity,
|
final Object entity,
|
||||||
final Status status,
|
final Status status,
|
||||||
|
@ -519,10 +528,12 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean containsCollection(PersistentCollection collection) {
|
public boolean containsCollection(PersistentCollection collection) {
|
||||||
return collectionEntries.containsKey(collection);
|
return collectionEntries.containsKey(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean containsProxy(Object entity) {
|
public boolean containsProxy(Object entity) {
|
||||||
return proxiesByKey.containsValue( entity );
|
return proxiesByKey.containsValue( entity );
|
||||||
}
|
}
|
||||||
|
@ -534,6 +545,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @return Whether the passed value represented an actual proxy which got initialized.
|
* @return Whether the passed value represented an actual proxy which got initialized.
|
||||||
* @throws MappingException
|
* @throws MappingException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean reassociateIfUninitializedProxy(Object value) throws MappingException {
|
public boolean reassociateIfUninitializedProxy(Object value) throws MappingException {
|
||||||
if ( value instanceof ElementWrapper ) {
|
if ( value instanceof ElementWrapper ) {
|
||||||
value = ( (ElementWrapper) value ).getElement();
|
value = ( (ElementWrapper) value ).getElement();
|
||||||
|
@ -554,6 +566,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* If a deleted entity instance is re-saved, and it has a proxy, we need to
|
* If a deleted entity instance is re-saved, and it has a proxy, we need to
|
||||||
* reset the identifier of the proxy
|
* reset the identifier of the proxy
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void reassociateProxy(Object value, Serializable id) throws MappingException {
|
public void reassociateProxy(Object value, Serializable id) throws MappingException {
|
||||||
if ( value instanceof ElementWrapper ) {
|
if ( value instanceof ElementWrapper ) {
|
||||||
value = ( (ElementWrapper) value ).getElement();
|
value = ( (ElementWrapper) value ).getElement();
|
||||||
|
@ -591,6 +604,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* an exception if the proxy is uninitialized. If the given object
|
* an exception if the proxy is uninitialized. If the given object
|
||||||
* is not a proxy, simply return the argument.
|
* is not a proxy, simply return the argument.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object unproxy(Object maybeProxy) throws HibernateException {
|
public Object unproxy(Object maybeProxy) throws HibernateException {
|
||||||
if ( maybeProxy instanceof ElementWrapper ) {
|
if ( maybeProxy instanceof ElementWrapper ) {
|
||||||
maybeProxy = ( (ElementWrapper) maybeProxy ).getElement();
|
maybeProxy = ( (ElementWrapper) maybeProxy ).getElement();
|
||||||
|
@ -619,6 +633,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @return The unproxied instance.
|
* @return The unproxied instance.
|
||||||
* @throws HibernateException
|
* @throws HibernateException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object unproxyAndReassociate(Object maybeProxy) throws HibernateException {
|
public Object unproxyAndReassociate(Object maybeProxy) throws HibernateException {
|
||||||
if ( maybeProxy instanceof ElementWrapper ) {
|
if ( maybeProxy instanceof ElementWrapper ) {
|
||||||
maybeProxy = ( (ElementWrapper) maybeProxy ).getElement();
|
maybeProxy = ( (ElementWrapper) maybeProxy ).getElement();
|
||||||
|
@ -641,6 +656,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @param object The entity reference against which to perform the uniqueness check.
|
* @param object The entity reference against which to perform the uniqueness check.
|
||||||
* @throws HibernateException
|
* @throws HibernateException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void checkUniqueness(EntityKey key, Object object) throws HibernateException {
|
public void checkUniqueness(EntityKey key, Object object) throws HibernateException {
|
||||||
Object entity = getEntity(key);
|
Object entity = getEntity(key);
|
||||||
if ( entity == object ) {
|
if ( entity == object ) {
|
||||||
|
@ -664,6 +680,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @return An appropriately narrowed instance.
|
* @return An appropriately narrowed instance.
|
||||||
* @throws HibernateException
|
* @throws HibernateException
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object narrowProxy(Object proxy, EntityPersister persister, EntityKey key, Object object)
|
public Object narrowProxy(Object proxy, EntityPersister persister, EntityKey key, Object object)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -711,6 +728,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* third argument (the entity associated with the key) if no proxy exists. Init
|
* third argument (the entity associated with the key) if no proxy exists. Init
|
||||||
* the proxy to the target implementation, if necessary.
|
* the proxy to the target implementation, if necessary.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object proxyFor(EntityPersister persister, EntityKey key, Object impl)
|
public Object proxyFor(EntityPersister persister, EntityKey key, Object impl)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
if ( !persister.hasProxy() ) return impl;
|
if ( !persister.hasProxy() ) return impl;
|
||||||
|
@ -728,6 +746,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* argument (the entity associated with the key) if no proxy exists.
|
* argument (the entity associated with the key) if no proxy exists.
|
||||||
* (slower than the form above)
|
* (slower than the form above)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object proxyFor(Object impl) throws HibernateException {
|
public Object proxyFor(Object impl) throws HibernateException {
|
||||||
EntityEntry e = getEntry(impl);
|
EntityEntry e = getEntry(impl);
|
||||||
return proxyFor( e.getPersister(), e.getEntityKey(), impl );
|
return proxyFor( e.getPersister(), e.getEntityKey(), impl );
|
||||||
|
@ -736,6 +755,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get the entity that owns this persistent collection
|
* Get the entity that owns this persistent collection
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getCollectionOwner(Serializable key, CollectionPersister collectionPersister) throws MappingException {
|
public Object getCollectionOwner(Serializable key, CollectionPersister collectionPersister) throws MappingException {
|
||||||
return getEntity( session.generateEntityKey( key, collectionPersister.getOwnerEntityPersister() ) );
|
return getEntity( session.generateEntityKey( key, collectionPersister.getOwnerEntityPersister() ) );
|
||||||
}
|
}
|
||||||
|
@ -747,6 +767,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @return the owner, if its entity ID is available from the collection's loaded key
|
* @return the owner, if its entity ID is available from the collection's loaded key
|
||||||
* and the owner entity is in the persistence context; otherwise, returns null
|
* and the owner entity is in the persistence context; otherwise, returns null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection) {
|
public Object getLoadedCollectionOwnerOrNull(PersistentCollection collection) {
|
||||||
CollectionEntry ce = getCollectionEntry( collection );
|
CollectionEntry ce = getCollectionEntry( collection );
|
||||||
if ( ce.getLoadedPersister() == null ) {
|
if ( ce.getLoadedPersister() == null ) {
|
||||||
|
@ -768,6 +789,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @param collection The persistent collection
|
* @param collection The persistent collection
|
||||||
* @return the owner ID if available from the collection's loaded key; otherwise, returns null
|
* @return the owner ID if available from the collection's loaded key; otherwise, returns null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection) {
|
public Serializable getLoadedCollectionOwnerIdOrNull(PersistentCollection collection) {
|
||||||
return getLoadedCollectionOwnerIdOrNull( getCollectionEntry( collection ) );
|
return getLoadedCollectionOwnerIdOrNull( getCollectionEntry( collection ) );
|
||||||
}
|
}
|
||||||
|
@ -790,6 +812,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* add a collection we just loaded up (still needs initializing)
|
* add a collection we just loaded up (still needs initializing)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addUninitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id) {
|
public void addUninitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id) {
|
||||||
CollectionEntry ce = new CollectionEntry(collection, persister, id, flushing);
|
CollectionEntry ce = new CollectionEntry(collection, persister, id, flushing);
|
||||||
addCollection(collection, ce, id);
|
addCollection(collection, ce, id);
|
||||||
|
@ -798,6 +821,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* add a detached uninitialized collection
|
* add a detached uninitialized collection
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addUninitializedDetachedCollection(CollectionPersister persister, PersistentCollection collection) {
|
public void addUninitializedDetachedCollection(CollectionPersister persister, PersistentCollection collection) {
|
||||||
CollectionEntry ce = new CollectionEntry( persister, collection.getKey() );
|
CollectionEntry ce = new CollectionEntry( persister, collection.getKey() );
|
||||||
addCollection( collection, ce, collection.getKey() );
|
addCollection( collection, ce, collection.getKey() );
|
||||||
|
@ -808,6 +832,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* application, with no database state or snapshot)
|
* application, with no database state or snapshot)
|
||||||
* @param collection The collection to be associated with the persistence context
|
* @param collection The collection to be associated with the persistence context
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addNewCollection(CollectionPersister persister, PersistentCollection collection)
|
public void addNewCollection(CollectionPersister persister, PersistentCollection collection)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
addCollection(collection, persister);
|
addCollection(collection, persister);
|
||||||
|
@ -851,6 +876,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* add an (initialized) collection that was created by another session and passed
|
* add an (initialized) collection that was created by another session and passed
|
||||||
* into update() (ie. one with a snapshot and existing state on the database)
|
* into update() (ie. one with a snapshot and existing state on the database)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addInitializedDetachedCollection(CollectionPersister collectionPersister, PersistentCollection collection)
|
public void addInitializedDetachedCollection(CollectionPersister collectionPersister, PersistentCollection collection)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
if ( collection.isUnreferenced() ) {
|
if ( collection.isUnreferenced() ) {
|
||||||
|
@ -866,6 +892,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* add a collection we just pulled out of the cache (does not need initializing)
|
* add a collection we just pulled out of the cache (does not need initializing)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public CollectionEntry addInitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)
|
public CollectionEntry addInitializedCollection(CollectionPersister persister, PersistentCollection collection, Serializable id)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
CollectionEntry ce = new CollectionEntry(collection, persister, id, flushing);
|
CollectionEntry ce = new CollectionEntry(collection, persister, id, flushing);
|
||||||
|
@ -877,6 +904,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get the collection instance associated with the <tt>CollectionKey</tt>
|
* Get the collection instance associated with the <tt>CollectionKey</tt>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public PersistentCollection getCollection(CollectionKey collectionKey) {
|
public PersistentCollection getCollection(CollectionKey collectionKey) {
|
||||||
return collectionsByKey.get( collectionKey );
|
return collectionsByKey.get( collectionKey );
|
||||||
}
|
}
|
||||||
|
@ -885,6 +913,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Register a collection for non-lazy loading at the end of the
|
* Register a collection for non-lazy loading at the end of the
|
||||||
* two-phase load
|
* two-phase load
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addNonLazyCollection(PersistentCollection collection) {
|
public void addNonLazyCollection(PersistentCollection collection) {
|
||||||
nonlazyCollections.add(collection);
|
nonlazyCollections.add(collection);
|
||||||
}
|
}
|
||||||
|
@ -894,6 +923,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* the current two-phase load (actually, this is a no-op, unless this
|
* the current two-phase load (actually, this is a no-op, unless this
|
||||||
* is the "outermost" load)
|
* is the "outermost" load)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void initializeNonLazyCollections() throws HibernateException {
|
public void initializeNonLazyCollections() throws HibernateException {
|
||||||
if ( loadCounter == 0 ) {
|
if ( loadCounter == 0 ) {
|
||||||
LOG.debug( "Initializing non-lazy collections" );
|
LOG.debug( "Initializing non-lazy collections" );
|
||||||
|
@ -917,6 +947,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get the <tt>PersistentCollection</tt> object for an array
|
* Get the <tt>PersistentCollection</tt> object for an array
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public PersistentCollection getCollectionHolder(Object array) {
|
public PersistentCollection getCollectionHolder(Object array) {
|
||||||
return arrayHolders.get(array);
|
return arrayHolders.get(array);
|
||||||
}
|
}
|
||||||
|
@ -926,11 +957,13 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Associates a holder with an array - MUST be called after loading
|
* Associates a holder with an array - MUST be called after loading
|
||||||
* array, since the array instance is not created until endLoad().
|
* array, since the array instance is not created until endLoad().
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addCollectionHolder(PersistentCollection holder) {
|
public void addCollectionHolder(PersistentCollection holder) {
|
||||||
//TODO:refactor + make this method private
|
//TODO:refactor + make this method private
|
||||||
arrayHolders.put( holder.getValue(), holder );
|
arrayHolders.put( holder.getValue(), holder );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PersistentCollection removeCollectionHolder(Object array) {
|
public PersistentCollection removeCollectionHolder(Object array) {
|
||||||
return arrayHolders.remove(array);
|
return arrayHolders.remove(array);
|
||||||
}
|
}
|
||||||
|
@ -938,6 +971,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get the snapshot of the pre-flush collection state
|
* Get the snapshot of the pre-flush collection state
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Serializable getSnapshot(PersistentCollection coll) {
|
public Serializable getSnapshot(PersistentCollection coll) {
|
||||||
return getCollectionEntry(coll).getSnapshot();
|
return getCollectionEntry(coll).getSnapshot();
|
||||||
}
|
}
|
||||||
|
@ -947,6 +981,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* which might be a collection wrapper, an array, or an unwrapped
|
* which might be a collection wrapper, an array, or an unwrapped
|
||||||
* collection. Return null if there is no entry.
|
* collection. Return null if there is no entry.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public CollectionEntry getCollectionEntryOrNull(Object collection) {
|
public CollectionEntry getCollectionEntryOrNull(Object collection) {
|
||||||
PersistentCollection coll;
|
PersistentCollection coll;
|
||||||
if ( collection instanceof PersistentCollection ) {
|
if ( collection instanceof PersistentCollection ) {
|
||||||
|
@ -975,6 +1010,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Get an existing proxy by key
|
* Get an existing proxy by key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getProxy(EntityKey key) {
|
public Object getProxy(EntityKey key) {
|
||||||
return proxiesByKey.get(key);
|
return proxiesByKey.get(key);
|
||||||
}
|
}
|
||||||
|
@ -982,6 +1018,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Add a proxy to the session cache
|
* Add a proxy to the session cache
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addProxy(EntityKey key, Object proxy) {
|
public void addProxy(EntityKey key, Object proxy) {
|
||||||
proxiesByKey.put(key, proxy);
|
proxiesByKey.put(key, proxy);
|
||||||
}
|
}
|
||||||
|
@ -995,6 +1032,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @param key The key of the entity proxy to be removed
|
* @param key The key of the entity proxy to be removed
|
||||||
* @return The proxy reference.
|
* @return The proxy reference.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object removeProxy(EntityKey key) {
|
public Object removeProxy(EntityKey key) {
|
||||||
if ( batchFetchQueue != null ) {
|
if ( batchFetchQueue != null ) {
|
||||||
batchFetchQueue.removeBatchLoadableEntityKey( key );
|
batchFetchQueue.removeBatchLoadableEntityKey( key );
|
||||||
|
@ -1003,35 +1041,15 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return proxiesByKey.remove( key );
|
return proxiesByKey.remove( key );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Record the fact that an entity does not exist in the database
|
|
||||||
*
|
|
||||||
* @param key the primary key of the entity
|
|
||||||
*/
|
|
||||||
/*public void addNonExistantEntityKey(EntityKey key) {
|
|
||||||
nonExistantEntityKeys.add(key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Record the fact that an entity does not exist in the database
|
|
||||||
*
|
|
||||||
* @param key a unique key of the entity
|
|
||||||
*/
|
|
||||||
/*public void addNonExistantEntityUniqueKey(EntityUniqueKey key) {
|
|
||||||
nonExistentEntityUniqueKeys.add(key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*public void removeNonExist(EntityKey key) {
|
|
||||||
nonExistantEntityKeys.remove(key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the set of EntityKeys representing nullifiable references
|
* Retrieve the set of EntityKeys representing nullifiable references
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public HashSet getNullifiableEntityKeys() {
|
public HashSet getNullifiableEntityKeys() {
|
||||||
return nullifiableEntityKeys;
|
return nullifiableEntityKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map getEntitiesByKey() {
|
public Map getEntitiesByKey() {
|
||||||
return entitiesByKey;
|
return entitiesByKey;
|
||||||
}
|
}
|
||||||
|
@ -1040,50 +1058,42 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return proxiesByKey;
|
return proxiesByKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map getEntityEntries() {
|
public Map getEntityEntries() {
|
||||||
return entityEntries;
|
return entityEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map getCollectionEntries() {
|
public Map getCollectionEntries() {
|
||||||
return collectionEntries;
|
return collectionEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map getCollectionsByKey() {
|
public Map getCollectionsByKey() {
|
||||||
return collectionsByKey;
|
return collectionsByKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Do we already know that the entity does not exist in the
|
|
||||||
* database?
|
|
||||||
*/
|
|
||||||
/*public boolean isNonExistant(EntityKey key) {
|
|
||||||
return nonExistantEntityKeys.contains(key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do we already know that the entity does not exist in the
|
|
||||||
* database?
|
|
||||||
*/
|
|
||||||
/*public boolean isNonExistant(EntityUniqueKey key) {
|
|
||||||
return nonExistentEntityUniqueKeys.contains(key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public int getCascadeLevel() {
|
public int getCascadeLevel() {
|
||||||
return cascading;
|
return cascading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int incrementCascadeLevel() {
|
public int incrementCascadeLevel() {
|
||||||
return ++cascading;
|
return ++cascading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int decrementCascadeLevel() {
|
public int decrementCascadeLevel() {
|
||||||
return --cascading;
|
return --cascading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFlushing() {
|
public boolean isFlushing() {
|
||||||
return flushing;
|
return flushing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFlushing(boolean flushing) {
|
public void setFlushing(boolean flushing) {
|
||||||
this.flushing = flushing;
|
this.flushing = flushing;
|
||||||
}
|
}
|
||||||
|
@ -1091,6 +1101,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Call this before beginning a two-phase load
|
* Call this before beginning a two-phase load
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void beforeLoad() {
|
public void beforeLoad() {
|
||||||
loadCounter++;
|
loadCounter++;
|
||||||
}
|
}
|
||||||
|
@ -1098,13 +1109,16 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Call this after finishing a two-phase load
|
* Call this after finishing a two-phase load
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void afterLoad() {
|
public void afterLoad() {
|
||||||
loadCounter--;
|
loadCounter--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLoadFinished() {
|
public boolean isLoadFinished() {
|
||||||
return loadCounter == 0;
|
return loadCounter == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string representation of the object.
|
* Returns a string representation of the object.
|
||||||
*
|
*
|
||||||
|
@ -1142,6 +1156,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* @return The id of the entityName instance which is said to own the child; null if an appropriate owner not
|
* @return The id of the entityName instance which is said to own the child; null if an appropriate owner not
|
||||||
* located.
|
* located.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Serializable getOwnerId(String entityName, String propertyName, Object childEntity, Map mergeMap) {
|
public Serializable getOwnerId(String entityName, String propertyName, Object childEntity, Map mergeMap) {
|
||||||
final String collectionRole = entityName + '.' + propertyName;
|
final String collectionRole = entityName + '.' + propertyName;
|
||||||
final EntityPersister persister = session.getFactory().getEntityPersister( entityName );
|
final EntityPersister persister = session.getFactory().getEntityPersister( entityName );
|
||||||
|
@ -1204,9 +1219,8 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
// NOTE: decided to put this here rather than in the above loop as I was nervous about the performance
|
// NOTE: decided to put this here rather than in the above loop as I was nervous about the performance
|
||||||
// of the loop-in-loop especially considering this is far more likely the 'edge case'
|
// of the loop-in-loop especially considering this is far more likely the 'edge case'
|
||||||
if ( mergeMap != null ) {
|
if ( mergeMap != null ) {
|
||||||
Iterator mergeMapItr = mergeMap.entrySet().iterator();
|
for ( Object o : mergeMap.entrySet() ) {
|
||||||
while ( mergeMapItr.hasNext() ) {
|
final Entry mergeMapEntry = (Entry) o;
|
||||||
final Map.Entry mergeMapEntry = ( Map.Entry ) mergeMapItr.next();
|
|
||||||
if ( mergeMapEntry.getKey() instanceof HibernateProxy ) {
|
if ( mergeMapEntry.getKey() instanceof HibernateProxy ) {
|
||||||
final HibernateProxy proxy = (HibernateProxy) mergeMapEntry.getKey();
|
final HibernateProxy proxy = (HibernateProxy) mergeMapEntry.getKey();
|
||||||
if ( persister.isSubclassEntityName( proxy.getHibernateLazyInitializer().getEntityName() ) ) {
|
if ( persister.isSubclassEntityName( proxy.getHibernateLazyInitializer().getEntityName() ) ) {
|
||||||
|
@ -1253,6 +1267,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Search the persistence context for an index of the child object,
|
* Search the persistence context for an index of the child object,
|
||||||
* given a collection role
|
* given a collection role
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getIndexInOwner(String entity, String property, Object childEntity, Map mergeMap) {
|
public Object getIndexInOwner(String entity, String property, Object childEntity, Map mergeMap) {
|
||||||
|
|
||||||
EntityPersister persister = session.getFactory()
|
EntityPersister persister = session.getFactory()
|
||||||
|
@ -1311,8 +1326,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
Object childEntity,
|
Object childEntity,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
CollectionPersister collectionPersister,
|
CollectionPersister collectionPersister,
|
||||||
Object potentialParent
|
Object potentialParent){
|
||||||
){
|
|
||||||
Object collection = persister.getPropertyValue( potentialParent, property );
|
Object collection = persister.getPropertyValue( potentialParent, property );
|
||||||
if ( collection!=null && Hibernate.isInitialized(collection) ) {
|
if ( collection!=null && Hibernate.isInitialized(collection) ) {
|
||||||
return collectionPersister.getCollectionType().indexOf(collection, childEntity);
|
return collectionPersister.getCollectionType().indexOf(collection, childEntity);
|
||||||
|
@ -1326,6 +1340,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
* Record the fact that the association belonging to the keyed
|
* Record the fact that the association belonging to the keyed
|
||||||
* entity is null.
|
* entity is null.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addNullProperty(EntityKey ownerKey, String propertyName) {
|
public void addNullProperty(EntityKey ownerKey, String propertyName) {
|
||||||
nullAssociations.add( new AssociationKey(ownerKey, propertyName) );
|
nullAssociations.add( new AssociationKey(ownerKey, propertyName) );
|
||||||
}
|
}
|
||||||
|
@ -1333,6 +1348,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Is the association property belonging to the keyed entity null?
|
* Is the association property belonging to the keyed entity null?
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isPropertyNull(EntityKey ownerKey, String propertyName) {
|
public boolean isPropertyNull(EntityKey ownerKey, String propertyName) {
|
||||||
return nullAssociations.contains( new AssociationKey(ownerKey, propertyName) );
|
return nullAssociations.contains( new AssociationKey(ownerKey, propertyName) );
|
||||||
}
|
}
|
||||||
|
@ -1341,6 +1357,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
nullAssociations.clear();
|
nullAssociations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isReadOnly(Object entityOrProxy) {
|
public boolean isReadOnly(Object entityOrProxy) {
|
||||||
if ( entityOrProxy == null ) {
|
if ( entityOrProxy == null ) {
|
||||||
throw new AssertionFailure( "object must be non-null." );
|
throw new AssertionFailure( "object must be non-null." );
|
||||||
|
@ -1359,6 +1376,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return isReadOnly;
|
return isReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setReadOnly(Object object, boolean readOnly) {
|
public void setReadOnly(Object object, boolean readOnly) {
|
||||||
if ( object == null ) {
|
if ( object == null ) {
|
||||||
throw new AssertionFailure( "object must be non-null." );
|
throw new AssertionFailure( "object must be non-null." );
|
||||||
|
@ -1404,6 +1422,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
hasNonReadOnlyEntities = hasNonReadOnlyEntities || ! readOnly;
|
hasNonReadOnlyEntities = hasNonReadOnlyEntities || ! readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId) {
|
public void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId) {
|
||||||
Object entity = entitiesByKey.remove( oldKey );
|
Object entity = entitiesByKey.remove( oldKey );
|
||||||
EntityEntry oldEntry = entityEntries.remove( entity );
|
EntityEntry oldEntry = entityEntries.remove( entity );
|
||||||
|
@ -1514,9 +1533,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
oos.writeInt( nullifiableEntityKeys.size() );
|
oos.writeInt( nullifiableEntityKeys.size() );
|
||||||
if ( tracing ) LOG.trace("Starting serialization of [" + nullifiableEntityKeys.size() + "] nullifiableEntityKey entries");
|
if ( tracing ) LOG.trace("Starting serialization of [" + nullifiableEntityKeys.size() + "] nullifiableEntityKey entries");
|
||||||
Iterator<EntityKey> entityKeyIterator = nullifiableEntityKeys.iterator();
|
for ( EntityKey entry : nullifiableEntityKeys ) {
|
||||||
while ( entityKeyIterator.hasNext() ) {
|
|
||||||
EntityKey entry = entityKeyIterator.next();
|
|
||||||
entry.serialize( oos );
|
entry.serialize( oos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1540,20 +1557,21 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
int count = ois.readInt();
|
int count = ois.readInt();
|
||||||
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] entitiesByKey entries");
|
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] entitiesByKey entries");
|
||||||
rtn.entitiesByKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
rtn.entitiesByKey = new HashMap<EntityKey,Object>( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||||
for ( int i = 0; i < count; i++ ) {
|
for ( int i = 0; i < count; i++ ) {
|
||||||
rtn.entitiesByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() );
|
rtn.entitiesByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() );
|
||||||
}
|
}
|
||||||
|
|
||||||
count = ois.readInt();
|
count = ois.readInt();
|
||||||
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] entitiesByUniqueKey entries");
|
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] entitiesByUniqueKey entries");
|
||||||
rtn.entitiesByUniqueKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
rtn.entitiesByUniqueKey = new HashMap<EntityUniqueKey,Object>( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||||
for ( int i = 0; i < count; i++ ) {
|
for ( int i = 0; i < count; i++ ) {
|
||||||
rtn.entitiesByUniqueKey.put( EntityUniqueKey.deserialize( ois, session ), ois.readObject() );
|
rtn.entitiesByUniqueKey.put( EntityUniqueKey.deserialize( ois, session ), ois.readObject() );
|
||||||
}
|
}
|
||||||
|
|
||||||
count = ois.readInt();
|
count = ois.readInt();
|
||||||
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] proxiesByKey entries");
|
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] proxiesByKey entries");
|
||||||
|
//noinspection unchecked
|
||||||
rtn.proxiesByKey = new ReferenceMap( AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK, count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count, .75f );
|
rtn.proxiesByKey = new ReferenceMap( AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK, count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count, .75f );
|
||||||
for ( int i = 0; i < count; i++ ) {
|
for ( int i = 0; i < count; i++ ) {
|
||||||
EntityKey ek = EntityKey.deserialize( ois, session );
|
EntityKey ek = EntityKey.deserialize( ois, session );
|
||||||
|
@ -1569,7 +1587,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
count = ois.readInt();
|
count = ois.readInt();
|
||||||
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] entitySnapshotsByKey entries");
|
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] entitySnapshotsByKey entries");
|
||||||
rtn.entitySnapshotsByKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
rtn.entitySnapshotsByKey = new HashMap<EntityKey,Object>( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||||
for ( int i = 0; i < count; i++ ) {
|
for ( int i = 0; i < count; i++ ) {
|
||||||
rtn.entitySnapshotsByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() );
|
rtn.entitySnapshotsByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() );
|
||||||
}
|
}
|
||||||
|
@ -1585,7 +1603,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
count = ois.readInt();
|
count = ois.readInt();
|
||||||
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] collectionsByKey entries");
|
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] collectionsByKey entries");
|
||||||
rtn.collectionsByKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
rtn.collectionsByKey = new HashMap<CollectionKey,PersistentCollection>( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||||
for ( int i = 0; i < count; i++ ) {
|
for ( int i = 0; i < count; i++ ) {
|
||||||
rtn.collectionsByKey.put( CollectionKey.deserialize( ois, session ), (PersistentCollection) ois.readObject() );
|
rtn.collectionsByKey.put( CollectionKey.deserialize( ois, session ), (PersistentCollection) ois.readObject() );
|
||||||
}
|
}
|
||||||
|
@ -1609,7 +1627,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
count = ois.readInt();
|
count = ois.readInt();
|
||||||
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] nullifiableEntityKey entries");
|
if ( tracing ) LOG.trace("Starting deserialization of [" + count + "] nullifiableEntityKey entries");
|
||||||
rtn.nullifiableEntityKeys = new HashSet();
|
rtn.nullifiableEntityKeys = new HashSet<EntityKey>();
|
||||||
for ( int i = 0; i < count; i++ ) {
|
for ( int i = 0; i < count; i++ ) {
|
||||||
rtn.nullifiableEntityKeys.add( EntityKey.deserialize( ois, session ) );
|
rtn.nullifiableEntityKeys.add( EntityKey.deserialize( ois, session ) );
|
||||||
}
|
}
|
||||||
|
@ -1622,16 +1640,12 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see org.hibernate.engine.spi.PersistenceContext#addChildParent(java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
public void addChildParent(Object child, Object parent) {
|
public void addChildParent(Object child, Object parent) {
|
||||||
parentsByChild.put(child, parent);
|
parentsByChild.put(child, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see org.hibernate.engine.spi.PersistenceContext#removeChildParent(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public void removeChildParent(Object child) {
|
public void removeChildParent(Object child) {
|
||||||
parentsByChild.remove(child);
|
parentsByChild.remove(child);
|
||||||
}
|
}
|
||||||
|
@ -1639,11 +1653,9 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
|
|
||||||
private HashMap<String,List<Serializable>> insertedKeysMap;
|
private HashMap<String,List<Serializable>> insertedKeysMap;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void registerInsertedKey(EntityPersister persister, Serializable id) {
|
public void registerInsertedKey(EntityPersister persister, Serializable id) {
|
||||||
// we only are about regsitering these if the persister defines caching
|
// we only are worried about registering these if the persister defines caching
|
||||||
if ( persister.hasCache() ) {
|
if ( persister.hasCache() ) {
|
||||||
if ( insertedKeysMap == null ) {
|
if ( insertedKeysMap == null ) {
|
||||||
insertedKeysMap = new HashMap<String, List<Serializable>>();
|
insertedKeysMap = new HashMap<String, List<Serializable>>();
|
||||||
|
@ -1658,9 +1670,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id) {
|
public boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id) {
|
||||||
// again, we only really care if the entity is cached
|
// again, we only really care if the entity is cached
|
||||||
if ( persister.hasCache() ) {
|
if ( persister.hasCache() ) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.hibernate.engine.jdbc.internal.TypeInfo;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public interface ExtractedDatabaseMetaData {
|
public interface ExtractedDatabaseMetaData {
|
||||||
|
|
||||||
public enum SQLStateType {
|
public enum SQLStateType {
|
||||||
|
@ -47,6 +48,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* Did the driver report to supporting scrollable result sets?
|
* Did the driver report to supporting scrollable result sets?
|
||||||
*
|
*
|
||||||
* @return True if the driver reported to support {@link java.sql.ResultSet#TYPE_SCROLL_INSENSITIVE}.
|
* @return True if the driver reported to support {@link java.sql.ResultSet#TYPE_SCROLL_INSENSITIVE}.
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#supportsResultSetType
|
* @see java.sql.DatabaseMetaData#supportsResultSetType
|
||||||
*/
|
*/
|
||||||
public boolean supportsScrollableResults();
|
public boolean supportsScrollableResults();
|
||||||
|
@ -55,6 +57,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* Did the driver report to supporting retrieval of generated keys?
|
* Did the driver report to supporting retrieval of generated keys?
|
||||||
*
|
*
|
||||||
* @return True if the if the driver reported to support calls to {@link java.sql.Statement#getGeneratedKeys}
|
* @return True if the if the driver reported to support calls to {@link java.sql.Statement#getGeneratedKeys}
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys
|
* @see java.sql.DatabaseMetaData#supportsGetGeneratedKeys
|
||||||
*/
|
*/
|
||||||
public boolean supportsGetGeneratedKeys();
|
public boolean supportsGetGeneratedKeys();
|
||||||
|
@ -63,6 +66,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* Did the driver report to supporting batched updates?
|
* Did the driver report to supporting batched updates?
|
||||||
*
|
*
|
||||||
* @return True if the driver supports batched updates
|
* @return True if the driver supports batched updates
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#supportsBatchUpdates
|
* @see java.sql.DatabaseMetaData#supportsBatchUpdates
|
||||||
*/
|
*/
|
||||||
public boolean supportsBatchUpdates();
|
public boolean supportsBatchUpdates();
|
||||||
|
@ -71,6 +75,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* Did the driver report to support performing DDL within transactions?
|
* Did the driver report to support performing DDL within transactions?
|
||||||
*
|
*
|
||||||
* @return True if the drivers supports DDL statements within transactions.
|
* @return True if the drivers supports DDL statements within transactions.
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#dataDefinitionIgnoredInTransactions
|
* @see java.sql.DatabaseMetaData#dataDefinitionIgnoredInTransactions
|
||||||
*/
|
*/
|
||||||
public boolean supportsDataDefinitionInTransaction();
|
public boolean supportsDataDefinitionInTransaction();
|
||||||
|
@ -81,6 +86,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
*
|
*
|
||||||
* @return True if the driver/database performs an implicit commit of transaction when DDL statement is
|
* @return True if the driver/database performs an implicit commit of transaction when DDL statement is
|
||||||
* performed
|
* performed
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()
|
* @see java.sql.DatabaseMetaData#dataDefinitionCausesTransactionCommit()
|
||||||
*/
|
*/
|
||||||
public boolean doesDataDefinitionCauseTransactionCommit();
|
public boolean doesDataDefinitionCauseTransactionCommit();
|
||||||
|
@ -89,6 +95,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* Get the list of extra keywords (beyond standard SQL92 keywords) reported by the driver.
|
* Get the list of extra keywords (beyond standard SQL92 keywords) reported by the driver.
|
||||||
*
|
*
|
||||||
* @return The extra keywords used by this database.
|
* @return The extra keywords used by this database.
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#getSQLKeywords()
|
* @see java.sql.DatabaseMetaData#getSQLKeywords()
|
||||||
*/
|
*/
|
||||||
public Set<String> getExtraKeywords();
|
public Set<String> getExtraKeywords();
|
||||||
|
@ -98,6 +105,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* the X/Open standard or the SQL92 standard.
|
* the X/Open standard or the SQL92 standard.
|
||||||
*
|
*
|
||||||
* @return The SQLState strategy reportedly used by this driver/database.
|
* @return The SQLState strategy reportedly used by this driver/database.
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#getSQLStateType()
|
* @see java.sql.DatabaseMetaData#getSQLStateType()
|
||||||
*/
|
*/
|
||||||
public SQLStateType getSqlStateType();
|
public SQLStateType getSqlStateType();
|
||||||
|
@ -106,6 +114,7 @@ public interface ExtractedDatabaseMetaData {
|
||||||
* Did the driver report that updates to a LOB locator affect a copy of the LOB?
|
* Did the driver report that updates to a LOB locator affect a copy of the LOB?
|
||||||
*
|
*
|
||||||
* @return True if updates to the state of a LOB locator update only a copy.
|
* @return True if updates to the state of a LOB locator update only a copy.
|
||||||
|
*
|
||||||
* @see java.sql.DatabaseMetaData#locatorsUpdateCopy()
|
* @see java.sql.DatabaseMetaData#locatorsUpdateCopy()
|
||||||
*/
|
*/
|
||||||
public boolean doesLobLocatorUpdateCopy();
|
public boolean doesLobLocatorUpdateCopy();
|
||||||
|
@ -127,7 +136,9 @@ public interface ExtractedDatabaseMetaData {
|
||||||
/**
|
/**
|
||||||
* Set of type info reported by the driver.
|
* Set of type info reported by the driver.
|
||||||
*
|
*
|
||||||
* @return
|
* @return The type information obtained from the driver.
|
||||||
|
*
|
||||||
|
* @see java.sql.DatabaseMetaData#getTypeInfo()
|
||||||
*/
|
*/
|
||||||
public LinkedHashSet<TypeInfo> getTypeInfoSet();
|
public LinkedHashSet<TypeInfo> getTypeInfoSet();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public interface JdbcCoordinator extends Serializable {
|
||||||
*
|
*
|
||||||
* @return The {@link Connection} associated with the managed {@link #getLogicalConnection() logical connection}
|
* @return The {@link Connection} associated with the managed {@link #getLogicalConnection() logical connection}
|
||||||
*
|
*
|
||||||
* @see {@link LogicalConnection#close()}
|
* @see LogicalConnection#close
|
||||||
*/
|
*/
|
||||||
public Connection close();
|
public Connection close();
|
||||||
|
|
||||||
|
|
|
@ -62,15 +62,15 @@ public interface LogicalConnection extends Serializable {
|
||||||
public Connection getConnection();
|
public Connection getConnection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the shareable connection proxy (see {@link org.hibernate.engine.jdbc.internal.proxy} for details).
|
* Retrieves the shareable connection proxy.
|
||||||
*
|
*
|
||||||
* @return The shareable connection proxy.
|
* @return The shareable connection proxy.
|
||||||
*/
|
*/
|
||||||
public Connection getShareableConnectionProxy();
|
public Connection getShareableConnectionProxy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a distinct connection proxy (see {@link org.hibernate.engine.jdbc.internal.proxy} for details). It
|
* Retrieves a distinct connection proxy. It is distinct in that it is not shared with others unless the caller
|
||||||
* is distinct in that it is not shared with others unless the caller explicitly shares it.
|
* explicitly shares it.
|
||||||
*
|
*
|
||||||
* @return The distinct connection proxy.
|
* @return The distinct connection proxy.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,12 +32,11 @@ import org.jboss.logging.Logger;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Tracks information about loading of entities specific to a given result set. These can be hierarchical.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class EntityLoadContext {
|
public class EntityLoadContext {
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, EntityLoadContext.class.getName() );
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, EntityLoadContext.class.getName() );
|
||||||
|
|
||||||
private final LoadContexts loadContexts;
|
private final LoadContexts loadContexts;
|
||||||
|
@ -50,7 +49,9 @@ public class EntityLoadContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
if ( !hydratingEntities.isEmpty() ) LOG.hydratingEntitiesCount( hydratingEntities.size() );
|
if ( !hydratingEntities.isEmpty() ) {
|
||||||
|
LOG.hydratingEntitiesCount( hydratingEntities.size() );
|
||||||
|
}
|
||||||
hydratingEntities.clear();
|
hydratingEntities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,18 +42,15 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps {@link ResultSet result-sets} to specific contextual data
|
* Maps {@link ResultSet result-sets} to specific contextual data related to processing that result set
|
||||||
* related to processing that {@link ResultSet result-sets}.
|
|
||||||
* <p/>
|
* <p/>
|
||||||
* Implementation note: internally an {@link IdentityMap} is used to maintain
|
* Implementation note: internally an {@link IdentityMap} is used to maintain the mappings mainly because I'd
|
||||||
* the mappings; {@link IdentityMap} was chosen because I'd rather not be
|
* rather not be dependent upon potentially bad {@link Object#equals} and {@link Object#hashCode} implementations on
|
||||||
* dependent upon potentially bad {@link ResultSet#equals} and {ResultSet#hashCode}
|
* the JDBC result sets
|
||||||
* implementations.
|
|
||||||
* <p/>
|
* <p/>
|
||||||
* Considering the JDBC-redesign work, would further like this contextual info
|
* Considering the JDBC-redesign work, would further like this contextual info not mapped separately, but available
|
||||||
* not mapped seperately, but available based on the result set being processed.
|
* based on the result set being processed. This would also allow maintaining a single mapping as we could reliably
|
||||||
* This would also allow maintaining a single mapping as we could reliably get
|
* get notification of the result-set closing...
|
||||||
* notification of the result-set closing...
|
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -257,7 +254,8 @@ public class LoadContexts {
|
||||||
xrefLoadingCollectionEntries.remove(key);
|
xrefLoadingCollectionEntries.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package*/Map getLoadingCollectionXRefs() {
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
|
Map getLoadingCollectionXRefs() {
|
||||||
return xrefLoadingCollectionEntries;
|
return xrefLoadingCollectionEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +296,7 @@ public class LoadContexts {
|
||||||
// Entity load contexts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// Entity load contexts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// * currently, not yet used...
|
// * currently, not yet used...
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public EntityLoadContext getEntityLoadContext(ResultSet resultSet) {
|
public EntityLoadContext getEntityLoadContext(ResultSet resultSet) {
|
||||||
EntityLoadContext context = null;
|
EntityLoadContext context = null;
|
||||||
if ( entityLoadContexts == null ) {
|
if ( entityLoadContexts == null ) {
|
||||||
|
|
|
@ -40,7 +40,9 @@ import org.hibernate.type.Type;
|
||||||
public interface Mapping {
|
public interface Mapping {
|
||||||
/**
|
/**
|
||||||
* Allow access to the id generator factory, though this is only needed/allowed from configuration.
|
* Allow access to the id generator factory, though this is only needed/allowed from configuration.
|
||||||
* @return
|
*
|
||||||
|
* @return Access to the identifier generator factory
|
||||||
|
*
|
||||||
* @deprecated temporary solution
|
* @deprecated temporary solution
|
||||||
*/
|
*/
|
||||||
public IdentifierGeneratorFactory getIdentifierGeneratorFactory();
|
public IdentifierGeneratorFactory getIdentifierGeneratorFactory();
|
||||||
|
|
|
@ -36,13 +36,23 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the state of the persistence context, including the
|
* Represents the state of "stuff" Hibernate is tracking, including (not exhaustive):
|
||||||
* first-level cache, entries, snapshots, proxies, etc.
|
* <ul>
|
||||||
|
* <li>entities</li>
|
||||||
|
* <li>collections</li>
|
||||||
|
* <li>snapshots</li>
|
||||||
|
* <li>proxies</li>
|
||||||
|
* </ul>
|
||||||
|
* <p/>
|
||||||
|
* Often referred to as the "first level cache".
|
||||||
*
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public interface PersistenceContext {
|
public interface PersistenceContext {
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean isStateless();
|
public boolean isStateless();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,18 +71,28 @@ public interface PersistenceContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a collection which has no owner loaded
|
* Add a collection which has no owner loaded
|
||||||
|
*
|
||||||
|
* @param key The collection key under which to add the collection
|
||||||
|
* @param collection The collection to add
|
||||||
*/
|
*/
|
||||||
public void addUnownedCollection(CollectionKey key, PersistentCollection collection);
|
public void addUnownedCollection(CollectionKey key, PersistentCollection collection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get and remove a collection whose owner is not yet loaded,
|
* Take ownership of a previously unowned collection, if one. This method returns {@code null} if no such
|
||||||
* when its owner is being loaded
|
* collection was previous added () or was previously removed.
|
||||||
|
* <p/>
|
||||||
|
* This should indicate the owner is being loaded and we are ready to "link" them.
|
||||||
|
*
|
||||||
|
* @param key The collection key for which to locate a collection collection
|
||||||
|
*
|
||||||
|
* @return The unowned collection, or {@code null}
|
||||||
*/
|
*/
|
||||||
public PersistentCollection useUnownedCollection(CollectionKey key);
|
public PersistentCollection useUnownedCollection(CollectionKey key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the <tt>BatchFetchQueue</tt>, instantiating one if
|
* Get the {@link BatchFetchQueue}, instantiating one if necessary.
|
||||||
* necessary.
|
*
|
||||||
|
* @return The batch fetch queue in effect for this persistence context
|
||||||
*/
|
*/
|
||||||
public BatchFetchQueue getBatchFetchQueue();
|
public BatchFetchQueue getBatchFetchQueue();
|
||||||
|
|
||||||
|
@ -84,10 +104,14 @@ public interface PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* @return false if we know for certain that all the entities are read-only
|
* @return false if we know for certain that all the entities are read-only
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean hasNonReadOnlyEntities();
|
public boolean hasNonReadOnlyEntities();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the status of an entry
|
* Set the status of an entry
|
||||||
|
*
|
||||||
|
* @param entry The entry for which to set the status
|
||||||
|
* @param status The new status
|
||||||
*/
|
*/
|
||||||
public void setEntryStatus(EntityEntry entry, Status status);
|
public void setEntryStatus(EntityEntry entry, Status status);
|
||||||
|
|
||||||
|
@ -97,94 +121,155 @@ public interface PersistenceContext {
|
||||||
public void afterTransactionCompletion();
|
public void afterTransactionCompletion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current state of the entity as known to the underlying
|
* Get the current state of the entity as known to the underlying database, or null if there is no
|
||||||
* database, or null if there is no corresponding row
|
* corresponding row
|
||||||
|
*
|
||||||
|
* @param id The identifier of the entity for which to grab a snapshot
|
||||||
|
* @param persister The persister of the entity.
|
||||||
|
*
|
||||||
|
* @return The entity's (non-cached) snapshot
|
||||||
|
*
|
||||||
|
* @see #getCachedDatabaseSnapshot
|
||||||
*/
|
*/
|
||||||
public Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister)
|
public Object[] getDatabaseSnapshot(Serializable id, EntityPersister persister);
|
||||||
throws HibernateException;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current database state of the entity, using the cached state snapshot if one is available.
|
||||||
|
*
|
||||||
|
* @param key The entity key
|
||||||
|
*
|
||||||
|
* @return The entity's (non-cached) snapshot
|
||||||
|
*/
|
||||||
public Object[] getCachedDatabaseSnapshot(EntityKey key);
|
public Object[] getCachedDatabaseSnapshot(EntityKey key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the values of the natural id fields as known to the underlying
|
* Get the values of the natural id fields as known to the underlying database, or null if the entity has no
|
||||||
* database, or null if the entity has no natural id or there is no
|
* natural id or there is no corresponding row.
|
||||||
* corresponding row.
|
*
|
||||||
|
* @param id The identifier of the entity for which to grab a snapshot
|
||||||
|
* @param persister The persister of the entity.
|
||||||
|
*
|
||||||
|
* @return The current (non-cached) snapshot of the entity's natural id state.
|
||||||
*/
|
*/
|
||||||
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister)
|
public Object[] getNaturalIdSnapshot(Serializable id, EntityPersister persister);
|
||||||
throws HibernateException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a canonical mapping from entity key to entity instance
|
* Add a canonical mapping from entity key to entity instance
|
||||||
|
*
|
||||||
|
* @param key The key under which to add an entity
|
||||||
|
* @param entity The entity instance to add
|
||||||
*/
|
*/
|
||||||
public void addEntity(EntityKey key, Object entity);
|
public void addEntity(EntityKey key, Object entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity instance associated with the given
|
* Get the entity instance associated with the given key
|
||||||
* <tt>EntityKey</tt>
|
*
|
||||||
|
* @param key The key under which to look for an entity
|
||||||
|
*
|
||||||
|
* @return The matching entity, or {@code null}
|
||||||
*/
|
*/
|
||||||
public Object getEntity(EntityKey key);
|
public Object getEntity(EntityKey key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is there an entity with the given key in the persistence context
|
* Is there an entity with the given key in the persistence context
|
||||||
|
*
|
||||||
|
* @param key The key under which to look for an entity
|
||||||
|
*
|
||||||
|
* @return {@code true} indicates an entity was found; otherwise {@code false}
|
||||||
*/
|
*/
|
||||||
public boolean containsEntity(EntityKey key);
|
public boolean containsEntity(EntityKey key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an entity from the session cache, also clear
|
* Remove an entity. Also clears up all other state associated with the entity aside from the {@link EntityEntry}
|
||||||
* up other state associated with the entity, all except
|
*
|
||||||
* for the <tt>EntityEntry</tt>
|
* @param key The key whose matching entity should be removed
|
||||||
|
*
|
||||||
|
* @return The matching entity
|
||||||
*/
|
*/
|
||||||
public Object removeEntity(EntityKey key);
|
public Object removeEntity(EntityKey key);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an entity cached by unique key
|
|
||||||
*/
|
|
||||||
public Object getEntity(EntityUniqueKey euk);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an entity to the cache by unique key
|
* Add an entity to the cache by unique key
|
||||||
|
*
|
||||||
|
* @param euk The unique (non-primary) key under which to add an entity
|
||||||
|
* @param entity The entity instance
|
||||||
*/
|
*/
|
||||||
public void addEntity(EntityUniqueKey euk, Object entity);
|
public void addEntity(EntityUniqueKey euk, Object entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retreive the EntityEntry representation of the given entity.
|
* Get an entity cached by unique key
|
||||||
*
|
*
|
||||||
* @param entity The entity for which to locate the EntityEntry.
|
* @param euk The unique (non-primary) key under which to look for an entity
|
||||||
* @return The EntityEntry for the given entity.
|
*
|
||||||
|
* @return The located entity
|
||||||
|
*/
|
||||||
|
public Object getEntity(EntityUniqueKey euk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the {@link EntityEntry} representation of the given entity.
|
||||||
|
*
|
||||||
|
* @param entity The entity instance for which to locate the corresponding entry
|
||||||
|
* @return The entry
|
||||||
*/
|
*/
|
||||||
public EntityEntry getEntry(Object entity);
|
public EntityEntry getEntry(Object entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an entity entry from the session cache
|
* Remove an entity entry from the session cache
|
||||||
|
*
|
||||||
|
* @param entity The entity instance for which to remove the corresponding entry
|
||||||
|
* @return The matching entry
|
||||||
*/
|
*/
|
||||||
public EntityEntry removeEntry(Object entity);
|
public EntityEntry removeEntry(Object entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is there an EntityEntry for this instance?
|
* Is there an {@link EntityEntry} registration for this entity instance?
|
||||||
|
*
|
||||||
|
* @param entity The entity instance for which to check for an entry
|
||||||
|
*
|
||||||
|
* @return {@code true} indicates a matching entry was found.
|
||||||
*/
|
*/
|
||||||
public boolean isEntryFor(Object entity);
|
public boolean isEntryFor(Object entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the collection entry for a persistent collection
|
* Get the collection entry for a persistent collection
|
||||||
|
*
|
||||||
|
* @param coll The persistent collection instance for which to locate the collection entry
|
||||||
|
*
|
||||||
|
* @return The matching collection entry
|
||||||
*/
|
*/
|
||||||
public CollectionEntry getCollectionEntry(PersistentCollection coll);
|
public CollectionEntry getCollectionEntry(PersistentCollection coll);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an entity to the internal caches.
|
* Adds an entity to the internal caches.
|
||||||
*/
|
*/
|
||||||
public EntityEntry addEntity(final Object entity, final Status status,
|
public EntityEntry addEntity(
|
||||||
final Object[] loadedState, final EntityKey entityKey, final Object version,
|
final Object entity,
|
||||||
final LockMode lockMode, final boolean existsInDatabase,
|
final Status status,
|
||||||
final EntityPersister persister, final boolean disableVersionIncrement, boolean lazyPropertiesAreUnfetched);
|
final Object[] loadedState,
|
||||||
|
final EntityKey entityKey,
|
||||||
|
final Object version,
|
||||||
|
final LockMode lockMode,
|
||||||
|
final boolean existsInDatabase,
|
||||||
|
final EntityPersister persister,
|
||||||
|
final boolean disableVersionIncrement,
|
||||||
|
boolean lazyPropertiesAreUnfetched);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an appropriate EntityEntry instance and adds it
|
* Generates an appropriate EntityEntry instance and adds it
|
||||||
* to the event source's internal caches.
|
* to the event source's internal caches.
|
||||||
*/
|
*/
|
||||||
public EntityEntry addEntry(final Object entity, final Status status,
|
public EntityEntry addEntry(
|
||||||
final Object[] loadedState, final Object rowId, final Serializable id,
|
final Object entity,
|
||||||
final Object version, final LockMode lockMode, final boolean existsInDatabase,
|
final Status status,
|
||||||
final EntityPersister persister, final boolean disableVersionIncrement, boolean lazyPropertiesAreUnfetched);
|
final Object[] loadedState,
|
||||||
|
final Object rowId,
|
||||||
|
final Serializable id,
|
||||||
|
final Object version,
|
||||||
|
final LockMode lockMode,
|
||||||
|
final boolean existsInDatabase,
|
||||||
|
final EntityPersister persister,
|
||||||
|
final boolean disableVersionIncrement,
|
||||||
|
boolean lazyPropertiesAreUnfetched);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the given collection associated with this persistence context?
|
* Is the given collection associated with this persistence context?
|
||||||
|
@ -428,6 +513,7 @@ public interface PersistenceContext {
|
||||||
/**
|
/**
|
||||||
* Is a flush cycle currently in process?
|
* Is a flush cycle currently in process?
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean isFlushing();
|
public boolean isFlushing();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -526,13 +612,14 @@ public interface PersistenceContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the entity or proxy read-only?
|
* Is the entity or proxy read-only?
|
||||||
|
* <p/>
|
||||||
|
* To determine the default read-only/modifiable setting used for entities and proxies that are loaded into the
|
||||||
|
* session use {@link org.hibernate.Session#isDefaultReadOnly}
|
||||||
*
|
*
|
||||||
* To get the default read-only/modifiable setting used for
|
* @param entityOrProxy an entity or proxy
|
||||||
* entities and proxies that are loaded into the session:
|
|
||||||
* @see org.hibernate.Session#isDefaultReadOnly()
|
|
||||||
*
|
*
|
||||||
* @param entityOrProxy
|
* @return {@code true} if the object is read-only; otherwise {@code false} to indicate that the object is
|
||||||
* @return true, the object is read-only; false, the object is modifiable.
|
* modifiable.
|
||||||
*/
|
*/
|
||||||
public boolean isReadOnly(Object entityOrProxy);
|
public boolean isReadOnly(Object entityOrProxy);
|
||||||
|
|
||||||
|
@ -551,35 +638,30 @@ public interface PersistenceContext {
|
||||||
* If the entity or proxy already has the specified read-only/modifiable
|
* If the entity or proxy already has the specified read-only/modifiable
|
||||||
* setting, then this method does nothing.
|
* setting, then this method does nothing.
|
||||||
*
|
*
|
||||||
* To set the default read-only/modifiable setting used for
|
* @param entityOrProxy an entity or proxy
|
||||||
* entities and proxies that are loaded into this persistence context:
|
* @param readOnly if {@code true}, the entity or proxy is made read-only; otherwise, the entity or proxy is made
|
||||||
* @see PersistenceContext#setDefaultReadOnly(boolean)
|
* modifiable.
|
||||||
* @see org.hibernate.Session#setDefaultReadOnly(boolean)
|
|
||||||
*
|
*
|
||||||
* To override this persistence context's read-only/modifiable setting
|
* @see org.hibernate.Session#setDefaultReadOnly
|
||||||
* for entities and proxies loaded by a Query:
|
* @see org.hibernate.Session#setReadOnly
|
||||||
* @see org.hibernate.Query#setReadOnly(boolean)
|
* @see org.hibernate.Query#setReadOnly
|
||||||
*
|
|
||||||
* @param entityOrProxy, an entity or HibernateProxy
|
|
||||||
* @param readOnly, if true, the entity or proxy is made read-only;
|
|
||||||
* if false, the entity or proxy is made modifiable.
|
|
||||||
*
|
|
||||||
* @see org.hibernate.Session#setReadOnly(Object, boolean)
|
|
||||||
*/
|
*/
|
||||||
public void setReadOnly(Object entityOrProxy, boolean readOnly);
|
public void setReadOnly(Object entityOrProxy, boolean readOnly);
|
||||||
|
|
||||||
void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId);
|
void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put child/parent relation to cache for cascading op
|
* Add a child/parent relation to cache for cascading op
|
||||||
* @param parent
|
*
|
||||||
* @param child
|
* @param child The child of the relationship
|
||||||
|
* @param parent The parent of the relationship
|
||||||
*/
|
*/
|
||||||
public void addChildParent(Object parent, Object child);
|
public void addChildParent(Object child, Object parent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove child/parent relation from cache
|
* Remove child/parent relation from cache
|
||||||
* @param parent
|
*
|
||||||
|
* @param child The child to be removed.
|
||||||
*/
|
*/
|
||||||
public void removeChildParent(Object child);
|
public void removeChildParent(Object child);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ import org.hibernate.type.Type;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public final class QueryParameters {
|
public final class QueryParameters {
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryParameters.class.getName());
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryParameters.class.getName());
|
||||||
|
|
||||||
private Type[] positionalParameterTypes;
|
private Type[] positionalParameterTypes;
|
||||||
|
@ -228,6 +227,7 @@ public final class QueryParameters {
|
||||||
this.optionalObject = optionalObject;
|
this.optionalObject = optionalObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean hasRowSelection() {
|
public boolean hasRowSelection() {
|
||||||
return rowSelection != null;
|
return rowSelection != null;
|
||||||
}
|
}
|
||||||
|
@ -252,6 +252,7 @@ public final class QueryParameters {
|
||||||
return resultTransformer;
|
return resultTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public void setNamedParameters(Map<String,TypedValue> map) {
|
public void setNamedParameters(Map<String,TypedValue> map) {
|
||||||
namedParameters = map;
|
namedParameters = map;
|
||||||
}
|
}
|
||||||
|
@ -264,6 +265,7 @@ public final class QueryParameters {
|
||||||
positionalParameterValues = objects;
|
positionalParameterValues = objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public void setRowSelection(RowSelection selection) {
|
public void setRowSelection(RowSelection selection) {
|
||||||
rowSelection = selection;
|
rowSelection = selection;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +335,7 @@ public final class QueryParameters {
|
||||||
return collectionKeys;
|
return collectionKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public void setCollectionKeys(Serializable[] collectionKeys) {
|
public void setCollectionKeys(Serializable[] collectionKeys) {
|
||||||
this.collectionKeys = collectionKeys;
|
this.collectionKeys = collectionKeys;
|
||||||
}
|
}
|
||||||
|
@ -399,9 +402,16 @@ public final class QueryParameters {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should entities and proxies loaded by the Query be put in read-only mode? If the
|
* Should entities and proxies loaded by the Query be put in read-only mode? If the
|
||||||
* read-only/modifiable setting was not initialized
|
* read-only/modifiable setting was not initialized (i.e., QueryParameters#isReadOnlyInitialized() == false),
|
||||||
* (i.e., QueryParameters#isReadOnlyInitialized() == false), then the default
|
* then the default read-only/modifiable setting for the persistence context is returned instead.
|
||||||
* read-only/modifiable setting for the persistence context is returned instead.
|
* <p/>
|
||||||
|
* The read-only/modifiable setting has no impact on entities/proxies returned by the
|
||||||
|
* query that existed in the session before the query was executed.
|
||||||
|
*
|
||||||
|
* @param session The originating session
|
||||||
|
*
|
||||||
|
* @return {@code true} indicates that entities and proxies loaded by the query will be put in read-only mode;
|
||||||
|
* {@code false} indicates that entities and proxies loaded by the query will be put in modifiable mode
|
||||||
*
|
*
|
||||||
* @see QueryParameters#isReadOnlyInitialized()
|
* @see QueryParameters#isReadOnlyInitialized()
|
||||||
* @see QueryParameters#setReadOnly(boolean)
|
* @see QueryParameters#setReadOnly(boolean)
|
||||||
|
@ -410,29 +420,26 @@ public final class QueryParameters {
|
||||||
* The read-only/modifiable setting has no impact on entities/proxies returned by the
|
* The read-only/modifiable setting has no impact on entities/proxies returned by the
|
||||||
* query that existed in the session before the query was executed.
|
* query that existed in the session before the query was executed.
|
||||||
*
|
*
|
||||||
* @return true, entities and proxies loaded by the query will be put in read-only mode
|
|
||||||
* false, entities and proxies loaded by the query will be put in modifiable mode
|
|
||||||
*/
|
*/
|
||||||
public boolean isReadOnly(SessionImplementor session) {
|
public boolean isReadOnly(SessionImplementor session) {
|
||||||
return ( isReadOnlyInitialized ?
|
return isReadOnlyInitialized
|
||||||
isReadOnly() :
|
? isReadOnly()
|
||||||
session.getPersistenceContext().isDefaultReadOnly()
|
: session.getPersistenceContext().isDefaultReadOnly();
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the read-only/modifiable mode for entities and proxies loaded by the query.
|
* Set the read-only/modifiable mode for entities and proxies loaded by the query.
|
||||||
* *
|
* <p/>
|
||||||
|
* The read-only/modifiable setting has no impact on entities/proxies returned by the
|
||||||
|
* query that existed in the session before the query was executed.
|
||||||
|
*
|
||||||
|
* @param readOnly if {@code true}, entities and proxies loaded by the query will be put in read-only mode; if
|
||||||
|
* {@code false}, entities and proxies loaded by the query will be put in modifiable mode
|
||||||
|
*
|
||||||
* @see QueryParameters#isReadOnlyInitialized()
|
* @see QueryParameters#isReadOnlyInitialized()
|
||||||
* @see QueryParameters#isReadOnly(org.hibernate.engine.spi.SessionImplementor)
|
* @see QueryParameters#isReadOnly(org.hibernate.engine.spi.SessionImplementor)
|
||||||
* @see QueryParameters#setReadOnly(boolean)
|
* @see QueryParameters#setReadOnly(boolean)
|
||||||
* @see org.hibernate.engine.spi.PersistenceContext#isDefaultReadOnly()
|
* @see org.hibernate.engine.spi.PersistenceContext#isDefaultReadOnly()
|
||||||
*
|
|
||||||
* The read-only/modifiable setting has no impact on entities/proxies returned by the
|
|
||||||
* query that existed in the session before the query was executed.
|
|
||||||
*
|
|
||||||
* @return true, entities and proxies loaded by the query will be put in read-only mode
|
|
||||||
* false, entities and proxies loaded by the query will be put in modifiable mode
|
|
||||||
*/
|
*/
|
||||||
public void setReadOnly(boolean readOnly) {
|
public void setReadOnly(boolean readOnly) {
|
||||||
this.readOnly = readOnly;
|
this.readOnly = readOnly;
|
||||||
|
@ -455,8 +462,9 @@ public final class QueryParameters {
|
||||||
processFilters( sql, session.getLoadQueryInfluencers().getEnabledFilters(), session.getFactory() );
|
processFilters( sql, session.getLoadQueryInfluencers().getEnabledFilters(), session.getFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"unchecked"})
|
||||||
public void processFilters(String sql, Map filters, SessionFactoryImplementor factory) {
|
public void processFilters(String sql, Map filters, SessionFactoryImplementor factory) {
|
||||||
if ( filters.size() == 0 || sql.indexOf( ParserHelper.HQL_VARIABLE_PREFIX ) < 0 ) {
|
if ( filters.size() == 0 || !sql.contains( ParserHelper.HQL_VARIABLE_PREFIX ) ) {
|
||||||
// HELLA IMPORTANT OPTIMIZATION!!!
|
// HELLA IMPORTANT OPTIMIZATION!!!
|
||||||
processedPositionalParameterValues = getPositionalParameterValues();
|
processedPositionalParameterValues = getPositionalParameterValues();
|
||||||
processedPositionalParameterTypes = getPositionalParameterTypes();
|
processedPositionalParameterTypes = getPositionalParameterTypes();
|
||||||
|
@ -469,7 +477,7 @@ public final class QueryParameters {
|
||||||
.append( dialect.closeQuote() )
|
.append( dialect.closeQuote() )
|
||||||
.toString();
|
.toString();
|
||||||
StringTokenizer tokens = new StringTokenizer( sql, symbols, true );
|
StringTokenizer tokens = new StringTokenizer( sql, symbols, true );
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
List parameters = new ArrayList();
|
List parameters = new ArrayList();
|
||||||
List parameterTypes = new ArrayList();
|
List parameterTypes = new ArrayList();
|
||||||
|
@ -532,6 +540,7 @@ public final class QueryParameters {
|
||||||
return isNaturalKeyLookup;
|
return isNaturalKeyLookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public void setNaturalKeyLookup(boolean isNaturalKeyLookup) {
|
public void setNaturalKeyLookup(boolean isNaturalKeyLookup) {
|
||||||
this.isNaturalKeyLookup = isNaturalKeyLookup;
|
this.isNaturalKeyLookup = isNaturalKeyLookup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
|
||||||
/**
|
/**
|
||||||
* Get the SQL dialect.
|
* Get the SQL dialect.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Shorthand for {@link #getJdbcServices().getDialect()}.{@link JdbcServices#getDialect()}
|
* Shorthand for {@code getJdbcServices().getDialect()}
|
||||||
*
|
*
|
||||||
* @return The dialect
|
* @return The dialect
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,9 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.hql.internal.ast;
|
package org.hibernate.hql.internal.ast;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* Indicates an issue with the encountered with-clause.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,6 +45,8 @@ public interface SelectExpression {
|
||||||
* (e.g. 'as col0_O_')
|
* (e.g. 'as col0_O_')
|
||||||
*
|
*
|
||||||
* @param i The index of the select expression in the projection list.
|
* @param i The index of the select expression in the projection list.
|
||||||
|
*
|
||||||
|
* @throws antlr.SemanticException if a semantic error occurs
|
||||||
*/
|
*/
|
||||||
void setScalarColumnText(int i) throws SemanticException;
|
void setScalarColumnText(int i) throws SemanticException;
|
||||||
|
|
||||||
|
@ -52,14 +54,15 @@ public interface SelectExpression {
|
||||||
* Sets the index and text for select expression in the projection list.
|
* Sets the index and text for select expression in the projection list.
|
||||||
*
|
*
|
||||||
* @param i The index of the select expression in the projection list.
|
* @param i The index of the select expression in the projection list.
|
||||||
* @throws SemanticException
|
*
|
||||||
|
* @throws SemanticException if a semantic error occurs
|
||||||
*/
|
*/
|
||||||
void setScalarColumn(int i) throws SemanticException;
|
void setScalarColumn(int i) throws SemanticException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets index of the select expression in the projection list.
|
* Gets index of the select expression in the projection list.
|
||||||
*
|
*
|
||||||
* @returns The index of the select expression in the projection list.
|
* @return The index of the select expression in the projection list.
|
||||||
*/
|
*/
|
||||||
int getScalarColumnIndex();
|
int getScalarColumnIndex();
|
||||||
|
|
||||||
|
@ -75,12 +78,15 @@ public interface SelectExpression {
|
||||||
*
|
*
|
||||||
* @return true if the element is a constructor (e.g. new Foo).
|
* @return true if the element is a constructor (e.g. new Foo).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
boolean isConstructor();
|
boolean isConstructor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this select expression represents an entity that can be returned.
|
* Returns true if this select expression represents an entity that can be returned.
|
||||||
*
|
*
|
||||||
* @return true if this select expression represents an entity that can be returned.
|
* @return true if this select expression represents an entity that can be returned.
|
||||||
|
*
|
||||||
|
* @throws SemanticException if a semantic error occurs
|
||||||
*/
|
*/
|
||||||
boolean isReturnableEntity() throws SemanticException;
|
boolean isReturnableEntity() throws SemanticException;
|
||||||
|
|
||||||
|
|
|
@ -58,25 +58,13 @@ import org.hibernate.type.Type;
|
||||||
* @author josh
|
* @author josh
|
||||||
*/
|
*/
|
||||||
public class LiteralProcessor implements HqlSqlTokenTypes {
|
public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
/**
|
|
||||||
* Indicates that Float and Double literal values should
|
|
||||||
* be treated using the SQL "exact" format (i.e., '.001')
|
|
||||||
*/
|
|
||||||
public static final int EXACT = 0;
|
|
||||||
/**
|
|
||||||
* Indicates that Float and Double literal values should
|
|
||||||
* be treated using the SQL "approximate" format (i.e., '1E-3')
|
|
||||||
*/
|
|
||||||
public static final int APPROXIMATE = 1;
|
|
||||||
/**
|
|
||||||
* In what format should Float and Double literal values be sent
|
|
||||||
* to the database?
|
|
||||||
* @see #EXACT, #APPROXIMATE
|
|
||||||
*/
|
|
||||||
public static int DECIMAL_LITERAL_FORMAT = EXACT;
|
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, LiteralProcessor.class.getName());
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, LiteralProcessor.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In what format should Float and Double literal values be sent to the database?
|
||||||
|
*/
|
||||||
|
public static DecimalLiteralFormat DECIMAL_LITERAL_FORMAT = DecimalLiteralFormat.EXACT;
|
||||||
|
|
||||||
private HqlSqlWalker walker;
|
private HqlSqlWalker walker;
|
||||||
|
|
||||||
public LiteralProcessor(HqlSqlWalker hqlSqlWalker) {
|
public LiteralProcessor(HqlSqlWalker hqlSqlWalker) {
|
||||||
|
@ -186,6 +174,7 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
try {
|
try {
|
||||||
LiteralType literalType = ( LiteralType ) type;
|
LiteralType literalType = ( LiteralType ) type;
|
||||||
Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
|
Dialect dialect = walker.getSessionFactoryHelper().getFactory().getDialect();
|
||||||
|
//noinspection unchecked
|
||||||
node.setText( literalType.objectToSQLString( value, dialect ) );
|
node.setText( literalType.objectToSQLString( value, dialect ) );
|
||||||
}
|
}
|
||||||
catch ( Exception e ) {
|
catch ( Exception e ) {
|
||||||
|
@ -279,7 +268,7 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal number = null;
|
final BigDecimal number;
|
||||||
try {
|
try {
|
||||||
number = new BigDecimal( literalValue );
|
number = new BigDecimal( literalValue );
|
||||||
}
|
}
|
||||||
|
@ -287,7 +276,7 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
throw new HibernateException( "Could not parse literal [" + text + "] as big-decimal", t );
|
throw new HibernateException( "Could not parse literal [" + text + "] as big-decimal", t );
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatters[ DECIMAL_LITERAL_FORMAT ].format( number );
|
return DECIMAL_LITERAL_FORMAT.getFormatter().format( number );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,13 +285,18 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ExactDecimalFormatter implements DecimalFormatter {
|
private static class ExactDecimalFormatter implements DecimalFormatter {
|
||||||
|
public static final ExactDecimalFormatter INSTANCE = new ExactDecimalFormatter();
|
||||||
|
|
||||||
public String format(BigDecimal number) {
|
public String format(BigDecimal number) {
|
||||||
return number.toString();
|
return number.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ApproximateDecimalFormatter implements DecimalFormatter {
|
private static class ApproximateDecimalFormatter implements DecimalFormatter {
|
||||||
|
public static final ApproximateDecimalFormatter INSTANCE = new ApproximateDecimalFormatter();
|
||||||
|
|
||||||
private static final String FORMAT_STRING = "#0.0E0";
|
private static final String FORMAT_STRING = "#0.0E0";
|
||||||
|
|
||||||
public String format(BigDecimal number) {
|
public String format(BigDecimal number) {
|
||||||
try {
|
try {
|
||||||
// TODO : what amount of significant digits need to be supported here?
|
// TODO : what amount of significant digits need to be supported here?
|
||||||
|
@ -319,8 +313,30 @@ public class LiteralProcessor implements HqlSqlTokenTypes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final DecimalFormatter[] formatters = new DecimalFormatter[] {
|
public static enum DecimalLiteralFormat {
|
||||||
new ExactDecimalFormatter(),
|
/**
|
||||||
new ApproximateDecimalFormatter()
|
* Indicates that Float and Double literal values should
|
||||||
};
|
* be treated using the SQL "exact" format (i.e., '.001')
|
||||||
|
*/
|
||||||
|
EXACT {
|
||||||
|
@Override
|
||||||
|
public DecimalFormatter getFormatter() {
|
||||||
|
return ExactDecimalFormatter.INSTANCE;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Indicates that Float and Double literal values should
|
||||||
|
* be treated using the SQL "approximate" format (i.e., '1E-3')
|
||||||
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
|
APPROXIMATE {
|
||||||
|
@Override
|
||||||
|
public DecimalFormatter getFormatter() {
|
||||||
|
return ApproximateDecimalFormatter.INSTANCE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract DecimalFormatter getFormatter();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -33,15 +33,17 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistry;
|
||||||
* <p/>
|
* <p/>
|
||||||
* IMPL NOTE: called during session factory initialization (constructor), so not all parts of the passed session factory
|
* IMPL NOTE: called during session factory initialization (constructor), so not all parts of the passed session factory
|
||||||
* will be available.
|
* will be available.
|
||||||
*
|
* <p/>
|
||||||
* @todo : the signature here *will* change, guaranteed
|
* For more information, see the following jiras:<ul>
|
||||||
*
|
* <li><a href="https://hibernate.onjira.com/browse/HHH-5562">HHH-5562</a></li>
|
||||||
* @todo : better name ?
|
* <li><a href="https://hibernate.onjira.com/browse/HHH-6081">HHH-6081</a></li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
* @jira HHH-5562
|
*
|
||||||
* @jira HHH-6081
|
* @todo : the signature here *will* change, guaranteed
|
||||||
|
* @todo : better name ?
|
||||||
*/
|
*/
|
||||||
public interface Integrator {
|
public interface Integrator {
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
@ -105,11 +104,13 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
|
|
||||||
// inserts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// inserts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable insert(Object entity) {
|
public Serializable insert(Object entity) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return insert(null, entity);
|
return insert(null, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable insert(String entityName, Object entity) {
|
public Serializable insert(String entityName, Object entity) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
EntityPersister persister = getEntityPersister( entityName, entity );
|
EntityPersister persister = getEntityPersister( entityName, entity );
|
||||||
|
@ -136,11 +137,13 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
|
|
||||||
// deletes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// deletes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void delete(Object entity) {
|
public void delete(Object entity) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
delete(null, entity);
|
delete(null, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void delete(String entityName, Object entity) {
|
public void delete(String entityName, Object entity) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
EntityPersister persister = getEntityPersister(entityName, entity);
|
EntityPersister persister = getEntityPersister(entityName, entity);
|
||||||
|
@ -152,11 +155,13 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
|
|
||||||
// updates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// updates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void update(Object entity) {
|
public void update(Object entity) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
update(null, entity);
|
update(null, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void update(String entityName, Object entity) {
|
public void update(String entityName, Object entity) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
EntityPersister persister = getEntityPersister(entityName, entity);
|
EntityPersister persister = getEntityPersister(entityName, entity);
|
||||||
|
@ -178,18 +183,22 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
|
|
||||||
// loading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// loading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(Class entityClass, Serializable id) {
|
public Object get(Class entityClass, Serializable id) {
|
||||||
return get( entityClass.getName(), id );
|
return get( entityClass.getName(), id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(Class entityClass, Serializable id, LockMode lockMode) {
|
public Object get(Class entityClass, Serializable id, LockMode lockMode) {
|
||||||
return get( entityClass.getName(), id, lockMode );
|
return get( entityClass.getName(), id, lockMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(String entityName, Serializable id) {
|
public Object get(String entityName, Serializable id) {
|
||||||
return get(entityName, id, LockMode.NONE);
|
return get(entityName, id, LockMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(String entityName, Serializable id, LockMode lockMode) {
|
public Object get(String entityName, Serializable id, LockMode lockMode) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
Object result = getFactory().getEntityPersister(entityName)
|
Object result = getFactory().getEntityPersister(entityName)
|
||||||
|
@ -200,18 +209,22 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(Object entity) {
|
public void refresh(Object entity) {
|
||||||
refresh( bestGuessEntityName( entity ), entity, LockMode.NONE );
|
refresh( bestGuessEntityName( entity ), entity, LockMode.NONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(String entityName, Object entity) {
|
public void refresh(String entityName, Object entity) {
|
||||||
refresh( entityName, entity, LockMode.NONE );
|
refresh( entityName, entity, LockMode.NONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(Object entity, LockMode lockMode) {
|
public void refresh(Object entity, LockMode lockMode) {
|
||||||
refresh( bestGuessEntityName( entity ), entity, lockMode );
|
refresh( bestGuessEntityName( entity ), entity, lockMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(String entityName, Object entity, LockMode lockMode) {
|
public void refresh(String entityName, Object entity, LockMode lockMode) {
|
||||||
final EntityPersister persister = this.getEntityPersister( entityName, entity );
|
final EntityPersister persister = this.getEntityPersister( entityName, entity );
|
||||||
final Serializable id = persister.getIdentifier( entity, this );
|
final Serializable id = persister.getIdentifier( entity, this );
|
||||||
|
@ -245,25 +258,28 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
UnresolvableObjectException.throwIfNull( result, id, persister.getEntityName() );
|
UnresolvableObjectException.throwIfNull( result, id, persister.getEntityName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object immediateLoad(String entityName, Serializable id)
|
public Object immediateLoad(String entityName, Serializable id)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
throw new SessionException("proxies cannot be fetched by a stateless session");
|
throw new SessionException("proxies cannot be fetched by a stateless session");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void initializeCollection(
|
public void initializeCollection(
|
||||||
PersistentCollection collection,
|
PersistentCollection collection,
|
||||||
boolean writing) throws HibernateException {
|
boolean writing) throws HibernateException {
|
||||||
throw new SessionException("collections cannot be fetched by a stateless session");
|
throw new SessionException("collections cannot be fetched by a stateless session");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object instantiate(
|
public Object instantiate(
|
||||||
String entityName,
|
String entityName,
|
||||||
Serializable id) throws HibernateException {
|
Serializable id) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return getFactory().getEntityPersister( entityName )
|
return getFactory().getEntityPersister( entityName ).instantiate( id, this );
|
||||||
.instantiate( id, this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object internalLoad(
|
public Object internalLoad(
|
||||||
String entityName,
|
String entityName,
|
||||||
Serializable id,
|
Serializable id,
|
||||||
|
@ -287,29 +303,34 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return get( entityName, id );
|
return get( entityName, id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
|
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
|
public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List listFilter(Object collection, String filter, QueryParameters queryParameters)
|
public List listFilter(Object collection, String filter, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
return !isClosed();
|
return !isClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
managedClose();
|
managedClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConnectionReleaseMode getConnectionReleaseMode() {
|
public ConnectionReleaseMode getConnectionReleaseMode() {
|
||||||
return factory.getSettings().getConnectionReleaseMode();
|
return factory.getSettings().getConnectionReleaseMode();
|
||||||
}
|
}
|
||||||
|
@ -319,18 +340,22 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAutoCloseSessionEnabled() {
|
public boolean isAutoCloseSessionEnabled() {
|
||||||
return factory.getSettings().isAutoCloseSessionEnabled();
|
return factory.getSettings().isAutoCloseSessionEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFlushBeforeCompletionEnabled() {
|
public boolean isFlushBeforeCompletionEnabled() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFlushModeNever() {
|
public boolean isFlushModeNever() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void managedClose() {
|
public void managedClose() {
|
||||||
if ( isClosed() ) {
|
if ( isClosed() ) {
|
||||||
throw new SessionException( "Session was already closed!" );
|
throw new SessionException( "Session was already closed!" );
|
||||||
|
@ -339,11 +364,13 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
setClosed();
|
setClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void managedFlush() {
|
public void managedFlush() {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
getTransactionCoordinator().getJdbcCoordinator().executeBatch();
|
getTransactionCoordinator().getJdbcCoordinator().executeBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean shouldAutoClose() {
|
public boolean shouldAutoClose() {
|
||||||
return isAutoCloseSessionEnabled() && !isClosed();
|
return isAutoCloseSessionEnabled() && !isClosed();
|
||||||
}
|
}
|
||||||
|
@ -368,6 +395,7 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String bestGuessEntityName(Object object) {
|
public String bestGuessEntityName(Object object) {
|
||||||
if (object instanceof HibernateProxy) {
|
if (object instanceof HibernateProxy) {
|
||||||
object = ( (HibernateProxy) object ).getHibernateLazyInitializer().getImplementation();
|
object = ( (HibernateProxy) object ).getHibernateLazyInitializer().getImplementation();
|
||||||
|
@ -375,11 +403,13 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return guessEntityName(object);
|
return guessEntityName(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Connection connection() {
|
public Connection connection() {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getDistinctConnectionProxy();
|
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getDistinctConnectionProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int executeUpdate(String query, QueryParameters queryParameters)
|
public int executeUpdate(String query, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -398,18 +428,22 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CacheMode getCacheMode() {
|
public CacheMode getCacheMode() {
|
||||||
return CacheMode.IGNORE;
|
return CacheMode.IGNORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getDontFlushFromFind() {
|
public int getDontFlushFromFind() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Map getEnabledFilters() {
|
public Map getEnabledFilters() {
|
||||||
return CollectionHelper.EMPTY_MAP;
|
return CollectionHelper.EMPTY_MAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable getContextEntityIdentifier(Object object) {
|
public Serializable getContextEntityIdentifier(Object object) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return null;
|
return null;
|
||||||
|
@ -419,6 +453,7 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return EntityMode.POJO;
|
return EntityMode.POJO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityPersister getEntityPersister(String entityName, Object object)
|
public EntityPersister getEntityPersister(String entityName, Object object)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -430,49 +465,59 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException {
|
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getFilterParameterType(String filterParameterName) {
|
public Type getFilterParameterType(String filterParameterName) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getFilterParameterValue(String filterParameterName) {
|
public Object getFilterParameterValue(String filterParameterName) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public FlushMode getFlushMode() {
|
public FlushMode getFlushMode() {
|
||||||
return FlushMode.COMMIT;
|
return FlushMode.COMMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Interceptor getInterceptor() {
|
public Interceptor getInterceptor() {
|
||||||
return EmptyInterceptor.INSTANCE;
|
return EmptyInterceptor.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PersistenceContext getPersistenceContext() {
|
public PersistenceContext getPersistenceContext() {
|
||||||
return temporaryPersistenceContext;
|
return temporaryPersistenceContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTimestamp() {
|
public long getTimestamp() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String guessEntityName(Object entity) throws HibernateException {
|
public String guessEntityName(Object entity) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return entity.getClass().getName();
|
return entity.getClass().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().isPhysicallyConnected();
|
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().isPhysicallyConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isTransactionInProgress() {
|
public boolean isTransactionInProgress() {
|
||||||
return transactionCoordinator.isTransactionInProgress();
|
return transactionCoordinator.isTransactionInProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAutoClear(boolean enabled) {
|
public void setAutoClear(boolean enabled) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@ -482,19 +527,23 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCacheMode(CacheMode cm) {
|
public void setCacheMode(CacheMode cm) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFlushMode(FlushMode fm) {
|
public void setFlushMode(FlushMode fm) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Transaction getTransaction() throws HibernateException {
|
public Transaction getTransaction() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return transactionCoordinator.getTransaction();
|
return transactionCoordinator.getTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Transaction beginTransaction() throws HibernateException {
|
public Transaction beginTransaction() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
Transaction result = getTransaction();
|
Transaction result = getTransaction();
|
||||||
|
@ -502,22 +551,17 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEventSource() {
|
public boolean isEventSource() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isDefaultReadOnly() {
|
public boolean isDefaultReadOnly() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setDefaultReadOnly(boolean readOnly) throws HibernateException {
|
public void setDefaultReadOnly(boolean readOnly) throws HibernateException {
|
||||||
if ( readOnly == true ) {
|
if ( readOnly ) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,6 +570,7 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
|
|
||||||
//TODO: COPY/PASTE FROM SessionImpl, pull up!
|
//TODO: COPY/PASTE FROM SessionImpl, pull up!
|
||||||
|
|
||||||
|
@Override
|
||||||
public List list(String query, QueryParameters queryParameters) throws HibernateException {
|
public List list(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
queryParameters.validateParameters();
|
queryParameters.validateParameters();
|
||||||
|
@ -545,30 +590,35 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
|
|
||||||
public void afterOperation(boolean success) {
|
public void afterOperation(boolean success) {
|
||||||
if ( ! transactionCoordinator.isTransactionInProgress() ) {
|
if ( ! transactionCoordinator.isTransactionInProgress() ) {
|
||||||
transactionCoordinator.afterNonTransactionalQuery( success );;
|
transactionCoordinator.afterNonTransactionalQuery( success );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(Class persistentClass, String alias) {
|
public Criteria createCriteria(Class persistentClass, String alias) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return new CriteriaImpl( persistentClass.getName(), alias, this );
|
return new CriteriaImpl( persistentClass.getName(), alias, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(String entityName, String alias) {
|
public Criteria createCriteria(String entityName, String alias) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return new CriteriaImpl(entityName, alias, this);
|
return new CriteriaImpl(entityName, alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(Class persistentClass) {
|
public Criteria createCriteria(Class persistentClass) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return new CriteriaImpl( persistentClass.getName(), this );
|
return new CriteriaImpl( persistentClass.getName(), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(String entityName) {
|
public Criteria createCriteria(String entityName) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return new CriteriaImpl(entityName, this);
|
return new CriteriaImpl(entityName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScrollableResults scroll(CriteriaImpl criteria, ScrollMode scrollMode) {
|
public ScrollableResults scroll(CriteriaImpl criteria, ScrollMode scrollMode) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
String entityName = criteria.getEntityOrClassName();
|
String entityName = criteria.getEntityOrClassName();
|
||||||
|
@ -582,6 +632,8 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return loader.scroll(this, scrollMode);
|
return loader.scroll(this, scrollMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings( {"unchecked"})
|
||||||
public List list(CriteriaImpl criteria) throws HibernateException {
|
public List list(CriteriaImpl criteria) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
String[] implementors = factory.getImplementors( criteria.getEntityOrClassName() );
|
String[] implementors = factory.getImplementors( criteria.getEntityOrClassName() );
|
||||||
|
@ -624,6 +676,7 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return ( OuterJoinLoadable ) persister;
|
return ( OuterJoinLoadable ) persister;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -642,6 +695,7 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -649,52 +703,47 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele
|
||||||
return loader.scroll( queryParameters, this );
|
return loader.scroll( queryParameters, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
|
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
HQLQueryPlan plan = getHQLQueryPlan( query, false );
|
HQLQueryPlan plan = getHQLQueryPlan( query, false );
|
||||||
return plan.performScroll( queryParameters, this );
|
return plan.performScroll( queryParameters, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterScrollOperation() {
|
public void afterScrollOperation() {
|
||||||
temporaryPersistenceContext.clear();
|
temporaryPersistenceContext.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flush() {}
|
@Override
|
||||||
|
public void flush() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public NonFlushedChanges getNonFlushedChanges() {
|
public NonFlushedChanges getNonFlushedChanges() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges) {
|
public void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getFetchProfile() {
|
public String getFetchProfile() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LoadQueryInfluencers getLoadQueryInfluencers() {
|
public LoadQueryInfluencers getLoadQueryInfluencers() {
|
||||||
return LoadQueryInfluencers.NONE;
|
return LoadQueryInfluencers.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerInsertedKey(EntityPersister persister, Serializable id) {
|
@Override
|
||||||
errorIfClosed();
|
public void setFetchProfile(String name) {
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id) {
|
|
||||||
errorIfClosed();
|
|
||||||
// not in any meaning we need to worry about here.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFetchProfile(String name) {}
|
|
||||||
|
|
||||||
protected boolean autoFlushIfRequired(Set querySpaces) throws HibernateException {
|
|
||||||
// no auto-flushing to support in stateless session
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification,
|
public int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification,
|
||||||
QueryParameters queryParameters) throws HibernateException {
|
QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!--
|
<!--
|
||||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
~
|
~
|
||||||
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
~ Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
~ indicated by the @author tags or express copyright attribution
|
~ indicated by the @author tags or express copyright attribution
|
||||||
~ statements applied by the authors. All third-party contributions are
|
~ statements applied by the authors. All third-party contributions are
|
||||||
~ distributed under license by Red Hat Inc.
|
~ distributed under license by Red Hat Inc.
|
||||||
|
@ -26,8 +26,7 @@
|
||||||
<head></head>
|
<head></head>
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
An internal package containing mostly implementations of central Hibernate APIs of the
|
An internal package containing mostly implementations of central Hibernate APIs.
|
||||||
{@link org.hibernate} package.
|
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!--
|
<!--
|
||||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
~
|
~
|
||||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
~ indicated by the @author tags or express copyright attribution
|
~ indicated by the @author tags or express copyright attribution
|
||||||
~ statements applied by the authors. All third-party contributions are
|
~ statements applied by the authors. All third-party contributions are
|
||||||
~ distributed under license by Red Hat Middleware LLC.
|
~ distributed under license by Red Hat Inc.
|
||||||
~
|
~
|
||||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
~ 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
|
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,14 +20,13 @@
|
||||||
~ Free Software Foundation, Inc.
|
~ Free Software Foundation, Inc.
|
||||||
~ 51 Franklin Street, Fifth Floor
|
~ 51 Franklin Street, Fifth Floor
|
||||||
~ Boston, MA 02110-1301 USA
|
~ Boston, MA 02110-1301 USA
|
||||||
~
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head></head>
|
|
||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
Essentially defines {@link Work}, {@link ReturningWork} and {@link Expectation} as well as some exceptions
|
Essentially defines {@link org.hibernate.jdbc.Work}, {@link org.hibernate.jdbc.ReturningWork} and
|
||||||
|
{@link org.hibernate.jdbc.Expectation} as well as some exceptions
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -41,8 +41,8 @@ public interface UniqueEntityLoader {
|
||||||
* load the entity state into the given (uninitialized) object.
|
* load the entity state into the given (uninitialized) object.
|
||||||
*
|
*
|
||||||
* @deprecated use {@link #load(java.io.Serializable, Object, SessionImplementor, LockOptions)} instead.
|
* @deprecated use {@link #load(java.io.Serializable, Object, SessionImplementor, LockOptions)} instead.
|
||||||
* @noinspection JavaDoc
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public Object load(Serializable id, Object optionalObject, SessionImplementor session) throws HibernateException;
|
public Object load(Serializable id, Object optionalObject, SessionImplementor session) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.hibernate.type.Type;
|
||||||
* @see org.hibernate.SessionFactory#getClassMetadata(Class)
|
* @see org.hibernate.SessionFactory#getClassMetadata(Class)
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public interface ClassMetadata {
|
public interface ClassMetadata {
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -135,6 +136,7 @@ public interface ClassMetadata {
|
||||||
/**
|
/**
|
||||||
* Return the values of the mapped properties of the object
|
* Return the values of the mapped properties of the object
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
|
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
|
@ -186,8 +188,8 @@ public interface ClassMetadata {
|
||||||
* Get the identifier of an instance (throw an exception if no identifier property)
|
* Get the identifier of an instance (throw an exception if no identifier property)
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #getIdentifier(Object,SessionImplementor)} instead
|
* @deprecated Use {@link #getIdentifier(Object,SessionImplementor)} instead
|
||||||
* @noinspection JavaDoc
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public Serializable getIdentifier(Object object) throws HibernateException;
|
public Serializable getIdentifier(Object object) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,6 +215,7 @@ public interface ClassMetadata {
|
||||||
/**
|
/**
|
||||||
* Does the class implement the <tt>Lifecycle</tt> interface?
|
* Does the class implement the <tt>Lifecycle</tt> interface?
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean implementsLifecycle();
|
public boolean implementsLifecycle();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,7 +56,7 @@ public interface AssociationAttributeBinding extends AttributeBinding {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary. Needed for integration with legacy {@link org.hibernate.mapping} configuration of persisters.
|
* Temporary. Needed for integration with legacy org.hibernate.mapping configuration of persisters.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,6 +29,7 @@ package org.hibernate.metamodel.binding;
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc", "UnusedDeclaration"})
|
||||||
public interface SingularAssociationAttributeBinding extends SingularAttributeBinding, AssociationAttributeBinding {
|
public interface SingularAssociationAttributeBinding extends SingularAttributeBinding, AssociationAttributeBinding {
|
||||||
/**
|
/**
|
||||||
* Is this association based on a property reference (non PK column(s) as target of FK)?
|
* Is this association based on a property reference (non PK column(s) as target of FK)?
|
||||||
|
|
|
@ -41,7 +41,8 @@ public interface Exportable {
|
||||||
/**
|
/**
|
||||||
* Gets the SQL strings for creating the database object.
|
* Gets the SQL strings for creating the database object.
|
||||||
*
|
*
|
||||||
* @param dialect
|
* @param dialect The dialect for which to generate the SQL creation strings
|
||||||
|
*
|
||||||
* @return the SQL strings for creating the database object.
|
* @return the SQL strings for creating the database object.
|
||||||
*/
|
*/
|
||||||
public String[] sqlCreateStrings(Dialect dialect);
|
public String[] sqlCreateStrings(Dialect dialect);
|
||||||
|
@ -49,7 +50,9 @@ public interface Exportable {
|
||||||
/**
|
/**
|
||||||
* Gets the SQL strings for dropping the database object.
|
* Gets the SQL strings for dropping the database object.
|
||||||
*
|
*
|
||||||
* @param dialect@return the SQL strings for dropping the database object.
|
* @param dialect The dialect for which to generate the SQL drop strings
|
||||||
|
*
|
||||||
|
* @return the SQL strings for dropping the database object.
|
||||||
*/
|
*/
|
||||||
public String[] sqlDropStrings(Dialect dialect);
|
public String[] sqlDropStrings(Dialect dialect);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class Identifier {
|
||||||
*
|
*
|
||||||
* @param name The name
|
* @param name The name
|
||||||
*
|
*
|
||||||
* @return
|
* @return The identifier form of the name.
|
||||||
*/
|
*/
|
||||||
public static Identifier toIdentifier(String name) {
|
public static Identifier toIdentifier(String name) {
|
||||||
if ( StringHelper.isEmpty( name ) ) {
|
if ( StringHelper.isEmpty( name ) ) {
|
||||||
|
@ -101,9 +101,9 @@ public class Identifier {
|
||||||
* enclosed in dialect-specific open- and end-quotes; otherwise,
|
* enclosed in dialect-specific open- and end-quotes; otherwise,
|
||||||
* simply return the identifier name.
|
* simply return the identifier name.
|
||||||
*
|
*
|
||||||
* @param dialect
|
* @param dialect The dialect whose dialect-specific quoting should be used.
|
||||||
* @return if quoted, identifier name enclosed in dialect-specific
|
* @return if quoted, identifier name enclosed in dialect-specific open- and end-quotes; otherwise, the
|
||||||
* open- and end-quotes; otherwise, the identifier name.
|
* identifier name.
|
||||||
*/
|
*/
|
||||||
public String encloseInQuotesIfQuoted(Dialect dialect) {
|
public String encloseInQuotesIfQuoted(Dialect dialect) {
|
||||||
return isQuoted ?
|
return isQuoted ?
|
||||||
|
|
|
@ -651,8 +651,8 @@ public interface EntityPersister extends OptimisticCacheSource {
|
||||||
* Get the identifier of an instance (throw an exception if no identifier property)
|
* Get the identifier of an instance (throw an exception if no identifier property)
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #getIdentifier(Object,SessionImplementor)} instead
|
* @deprecated Use {@link #getIdentifier(Object,SessionImplementor)} instead
|
||||||
* @noinspection JavaDoc
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public Serializable getIdentifier(Object object) throws HibernateException;
|
public Serializable getIdentifier(Object object) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ public abstract class AbstractSerializableProxy implements Serializable {
|
||||||
* This method should only be called during deserialization, before associating the
|
* This method should only be called during deserialization, before associating the
|
||||||
* AbstractLazyInitializer with a session.
|
* AbstractLazyInitializer with a session.
|
||||||
*
|
*
|
||||||
* @param li, the read-only/modifiable setting to use when
|
* @param li the read-only/modifiable setting to use when
|
||||||
* associated with a session; null indicates that the default should be used.
|
* associated with a session; null indicates that the default should be used.
|
||||||
* @throws IllegalStateException if isReadOnlySettingAvailable() == true
|
* @throws IllegalStateException if isReadOnlySettingAvailable() == true
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -117,12 +117,12 @@ public interface LazyInitializer {
|
||||||
* detached or its associated session is closed.
|
* detached or its associated session is closed.
|
||||||
*
|
*
|
||||||
* To check if the read-only/modifiable setting is available:
|
* To check if the read-only/modifiable setting is available:
|
||||||
* @see org.hibernate.proxy.LazyInitializer#isReadOnlySettingAvailable()
|
|
||||||
*
|
*
|
||||||
* @return true, if this proxy is read-only; false, otherwise
|
* @return true, if this proxy is read-only; false, otherwise
|
||||||
* @throws org.hibernate.TransientObjectException if the proxy is detached (getSession() == null)
|
* @throws org.hibernate.TransientObjectException if the proxy is detached (getSession() == null)
|
||||||
* @throws org.hibernate.SessionException if the proxy is associated with a sesssion that is closed
|
* @throws org.hibernate.SessionException if the proxy is associated with a sesssion that is closed
|
||||||
*
|
*
|
||||||
|
* @see org.hibernate.proxy.LazyInitializer#isReadOnlySettingAvailable()
|
||||||
* @see org.hibernate.Session#isReadOnly(Object entityOrProxy)
|
* @see org.hibernate.Session#isReadOnly(Object entityOrProxy)
|
||||||
*/
|
*/
|
||||||
public boolean isReadOnly();
|
public boolean isReadOnly();
|
||||||
|
@ -141,9 +141,9 @@ public interface LazyInitializer {
|
||||||
* @param readOnly if true, the associated proxy is made read-only;
|
* @param readOnly if true, the associated proxy is made read-only;
|
||||||
* if false, the associated proxy is made modifiable.
|
* if false, the associated proxy is made modifiable.
|
||||||
* @throws org.hibernate.TransientObjectException if the proxy is not association with a session
|
* @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
|
* @throws org.hibernate.SessionException if the proxy is associated with a session that is closed
|
||||||
*
|
*
|
||||||
* @see {@link org.hibernate.Session#setReadOnly(Object entityOrProxy, boolean readOnly)}
|
* @see org.hibernate.Session#setReadOnly(Object entityOrProxy, boolean readOnly)
|
||||||
*/
|
*/
|
||||||
public void setReadOnly(boolean readOnly);
|
public void setReadOnly(boolean readOnly);
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,12 @@ public class InFragment {
|
||||||
public static final String NOT_NULL = "not null";
|
public static final String NOT_NULL = "not null";
|
||||||
|
|
||||||
private String columnName;
|
private String columnName;
|
||||||
private List values = new ArrayList();
|
private List<Object> values = new ArrayList<Object>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param value, an SQL literal, NULL, or NOT_NULL
|
* @param value an SQL literal, NULL, or NOT_NULL
|
||||||
|
*
|
||||||
|
* @return {@code this}, for method chaining
|
||||||
*/
|
*/
|
||||||
public InFragment addValue(Object value) {
|
public InFragment addValue(Object value) {
|
||||||
values.add(value);
|
values.add(value);
|
||||||
|
@ -110,9 +112,7 @@ public class InFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Object value : values) {
|
for (Object value : values) {
|
||||||
if (NULL.equals(value)) {
|
if ( ! NULL.equals(value) ) {
|
||||||
;
|
|
||||||
} else {
|
|
||||||
buf.append(value);
|
buf.append(value);
|
||||||
buf.append(", ");
|
buf.append(", ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 20102011, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* 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
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.transform;
|
package org.hibernate.transform;
|
||||||
|
|
||||||
|
@ -32,7 +31,7 @@ import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ResultTransformer that is used to transfor tuples to a value(s)
|
* A ResultTransformer that is used to transform tuples to a value(s)
|
||||||
* that can be cached.
|
* that can be cached.
|
||||||
*
|
*
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
|
@ -74,16 +73,17 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
* included in the tuple; the number of true values equals
|
* included in the tuple; the number of true values equals
|
||||||
* the length of the tuple that will be transformed;
|
* the length of the tuple that will be transformed;
|
||||||
* must be non-null
|
* must be non-null
|
||||||
|
*
|
||||||
* @return a CacheableResultTransformer that is used to transform
|
* @return a CacheableResultTransformer that is used to transform
|
||||||
* tuples to a value(s) that can be cached.
|
* tuples to a value(s) that can be cached.
|
||||||
*/
|
*/
|
||||||
public static CacheableResultTransformer create(ResultTransformer transformer,
|
public static CacheableResultTransformer create(
|
||||||
|
ResultTransformer transformer,
|
||||||
String[] aliases,
|
String[] aliases,
|
||||||
boolean[] includeInTuple) {
|
boolean[] includeInTuple) {
|
||||||
return transformer instanceof TupleSubsetResultTransformer ?
|
return transformer instanceof TupleSubsetResultTransformer
|
||||||
create( ( TupleSubsetResultTransformer ) transformer, aliases, includeInTuple ) :
|
? create( ( TupleSubsetResultTransformer ) transformer, aliases, includeInTuple )
|
||||||
create( includeInTuple )
|
: create( includeInTuple );
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,10 +100,12 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
* included in the tuple; the number of true values equals
|
* included in the tuple; the number of true values equals
|
||||||
* the length of the tuple that will be transformed;
|
* the length of the tuple that will be transformed;
|
||||||
* must be non-null
|
* must be non-null
|
||||||
|
*
|
||||||
* @return a CacheableResultTransformer that is used to transform
|
* @return a CacheableResultTransformer that is used to transform
|
||||||
* tuples to a value(s) that can be cached.
|
* tuples to a value(s) that can be cached.
|
||||||
*/
|
*/
|
||||||
private static CacheableResultTransformer create(TupleSubsetResultTransformer transformer,
|
private static CacheableResultTransformer create(
|
||||||
|
TupleSubsetResultTransformer transformer,
|
||||||
String[] aliases,
|
String[] aliases,
|
||||||
boolean[] includeInTuple) {
|
boolean[] includeInTuple) {
|
||||||
if ( transformer == null ) {
|
if ( transformer == null ) {
|
||||||
|
@ -131,6 +133,7 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
* included in the tuple; the number of true values equals
|
* included in the tuple; the number of true values equals
|
||||||
* the length of the tuple that will be transformed;
|
* the length of the tuple that will be transformed;
|
||||||
* must be non-null
|
* must be non-null
|
||||||
|
*
|
||||||
* @return a CacheableResultTransformer that is used to transform
|
* @return a CacheableResultTransformer that is used to transform
|
||||||
* tuples to a value(s) that can be cached.
|
* tuples to a value(s) that can be cached.
|
||||||
*/
|
*/
|
||||||
|
@ -163,9 +166,7 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object transformTuple(Object[] tuple, String aliases[]) {
|
public Object transformTuple(Object[] tuple, String aliases[]) {
|
||||||
if ( aliases != null && aliases.length != tupleLength ) {
|
if ( aliases != null && aliases.length != tupleLength ) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
@ -191,9 +192,13 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
* @param transformedResults - results that were previously transformed
|
* @param transformedResults - results that were previously transformed
|
||||||
* @param aliases - the aliases that correspond to the untransformed tuple;
|
* @param aliases - the aliases that correspond to the untransformed tuple;
|
||||||
* @param transformer - the transformer for the re-transformation
|
* @param transformer - the transformer for the re-transformation
|
||||||
|
* @param includeInTuple indicates the indexes of
|
||||||
|
*
|
||||||
* @return transformedResults, with each element re-transformed (if nececessary)
|
* @return transformedResults, with each element re-transformed (if nececessary)
|
||||||
*/
|
*/
|
||||||
public List retransformResults(List transformedResults,
|
@SuppressWarnings( {"unchecked"})
|
||||||
|
public List retransformResults(
|
||||||
|
List transformedResults,
|
||||||
String aliases[],
|
String aliases[],
|
||||||
ResultTransformer transformer,
|
ResultTransformer transformer,
|
||||||
boolean[] includeInTuple) {
|
boolean[] includeInTuple) {
|
||||||
|
@ -244,6 +249,7 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
* @param results - results that were previously transformed
|
* @param results - results that were previously transformed
|
||||||
* @return results, with each element untransformed (if nececessary)
|
* @return results, with each element untransformed (if nececessary)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"unchecked"})
|
||||||
public List untransformToTuples(List results) {
|
public List untransformToTuples(List results) {
|
||||||
if ( includeInTransformIndex == null ) {
|
if ( includeInTransformIndex == null ) {
|
||||||
results = ACTUAL_TRANSFORMER.untransformToTuples(
|
results = ACTUAL_TRANSFORMER.untransformToTuples(
|
||||||
|
@ -264,21 +270,13 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the result types for the transformed value.
|
|
||||||
* @param tupleResultTypes
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Type[] getCachedResultTypes(Type[] tupleResultTypes) {
|
public Type[] getCachedResultTypes(Type[] tupleResultTypes) {
|
||||||
return tupleLength != tupleSubsetLength ?
|
return tupleLength != tupleSubsetLength
|
||||||
index( tupleResultTypes.getClass(), tupleResultTypes ) :
|
? index( tupleResultTypes.getClass(), tupleResultTypes )
|
||||||
tupleResultTypes
|
: tupleResultTypes;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public List transformList(List list) {
|
public List transformList(List list) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -320,20 +318,10 @@ public class CacheableResultTransformer implements ResultTransformer {
|
||||||
|
|
||||||
CacheableResultTransformer that = ( CacheableResultTransformer ) o;
|
CacheableResultTransformer that = ( CacheableResultTransformer ) o;
|
||||||
|
|
||||||
if ( tupleLength != that.tupleLength ) {
|
return tupleLength == that.tupleLength
|
||||||
return false;
|
&& tupleSubsetLength == that.tupleSubsetLength
|
||||||
}
|
&& Arrays.equals( includeInTuple, that.includeInTuple )
|
||||||
if ( tupleSubsetLength != that.tupleSubsetLength ) {
|
&& Arrays.equals( includeInTransformIndex, that.includeInTransformIndex );
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !Arrays.equals( includeInTuple, that.includeInTuple ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !Arrays.equals( includeInTransformIndex, that.includeInTransformIndex ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,8 +61,8 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
* @throws HibernateException
|
* @throws HibernateException
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #instantiate(Serializable, SessionImplementor)} instead.
|
* @deprecated Use {@link #instantiate(Serializable, SessionImplementor)} instead.
|
||||||
* @noinspection JavaDoc
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public Object instantiate(Serializable id) throws HibernateException;
|
public Object instantiate(Serializable id) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,8 +108,8 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
* @param id The value to be injected as the identifier.
|
* @param id The value to be injected as the identifier.
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #setIdentifier(Object, Serializable, SessionImplementor)} instead.
|
* @deprecated Use {@link #setIdentifier(Object, Serializable, SessionImplementor)} instead.
|
||||||
* @noinspection JavaDoc
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"JavaDoc"})
|
||||||
public void setIdentifier(Object entity, Serializable id) throws HibernateException;
|
public void setIdentifier(Object entity, Serializable id) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,6 +133,7 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #resetIdentifier(Object, Serializable, Object, SessionImplementor)} instead
|
* @deprecated Use {@link #resetIdentifier(Object, Serializable, Object, SessionImplementor)} instead
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion);
|
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +152,7 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
*
|
*
|
||||||
* @param entity The entity from which to extract the version value.
|
* @param entity The entity from which to extract the version value.
|
||||||
* @return The value of the version property, or null if not versioned.
|
* @return The value of the version property, or null if not versioned.
|
||||||
* @throws HibernateException
|
* @throws HibernateException Indicates a problem accessing the version property
|
||||||
*/
|
*/
|
||||||
public Object getVersion(Object entity) throws HibernateException;
|
public Object getVersion(Object entity) throws HibernateException;
|
||||||
|
|
||||||
|
@ -161,7 +162,7 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
* @param entity The entity into which to inject the value.
|
* @param entity The entity into which to inject the value.
|
||||||
* @param i The property's index.
|
* @param i The property's index.
|
||||||
* @param value The property value to inject.
|
* @param value The property value to inject.
|
||||||
* @throws HibernateException
|
* @throws HibernateException Indicates a problem access the property
|
||||||
*/
|
*/
|
||||||
public void setPropertyValue(Object entity, int i, Object value) throws HibernateException;
|
public void setPropertyValue(Object entity, int i, Object value) throws HibernateException;
|
||||||
|
|
||||||
|
@ -171,7 +172,7 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
* @param entity The entity into which to inject the value.
|
* @param entity The entity into which to inject the value.
|
||||||
* @param propertyName The name of the property.
|
* @param propertyName The name of the property.
|
||||||
* @param value The property value to inject.
|
* @param value The property value to inject.
|
||||||
* @throws HibernateException
|
* @throws HibernateException Indicates a problem access the property
|
||||||
*/
|
*/
|
||||||
public void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException;
|
public void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException;
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
* @param mergeMap a map of instances being merged to merged instances
|
* @param mergeMap a map of instances being merged to merged instances
|
||||||
* @param session The session in which the resuest is being made.
|
* @param session The session in which the resuest is being made.
|
||||||
* @return The insertable property values.
|
* @return The insertable property values.
|
||||||
* @throws HibernateException
|
* @throws HibernateException Indicates a problem access the properties
|
||||||
*/
|
*/
|
||||||
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
|
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
@ -193,7 +194,7 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
* @param entity The entity from which to extract the property value.
|
* @param entity The entity from which to extract the property value.
|
||||||
* @param propertyName The name of the property for which to extract the value.
|
* @param propertyName The name of the property for which to extract the value.
|
||||||
* @return The current value of the given property on the given entity.
|
* @return The current value of the given property on the given entity.
|
||||||
* @throws HibernateException
|
* @throws HibernateException Indicates a problem access the property
|
||||||
*/
|
*/
|
||||||
public Object getPropertyValue(Object entity, String propertyName) throws HibernateException;
|
public Object getPropertyValue(Object entity, String propertyName) throws HibernateException;
|
||||||
|
|
||||||
|
@ -252,6 +253,8 @@ public interface EntityTuplizer extends Tuplizer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is it an instrumented POJO?
|
* Is it an instrumented POJO?
|
||||||
|
*
|
||||||
|
* @return {@code true} if the entity class is instrumented; {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isInstrumented();
|
public boolean isInstrumented();
|
||||||
|
|
||||||
|
|
|
@ -167,14 +167,15 @@ public interface Type extends Serializable {
|
||||||
*/
|
*/
|
||||||
public Class getReturnedClass();
|
public Class getReturnedClass();
|
||||||
|
|
||||||
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
public boolean isXMLElement();
|
public boolean isXMLElement();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
|
* Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
|
||||||
* state) taking a shortcut for entity references.
|
* state) taking a shortcut for entity references.
|
||||||
* <p/>
|
* <p/>
|
||||||
* For most types this should equate to {@link #equals} check on the values. For associations the implication
|
* For most types this should equate to an {@link Object#equals equals} check on the values. For associations
|
||||||
* is a bit different. For most types it is conceivable to simply delegate to {@link #isEqual}
|
* the implication is a bit different. For most types it is conceivable to simply delegate to {@link #isEqual}
|
||||||
*
|
*
|
||||||
* @param x The first value
|
* @param x The first value
|
||||||
* @param y The second value
|
* @param y The second value
|
||||||
|
@ -222,7 +223,7 @@ public interface Type extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to
|
* Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to
|
||||||
* delegate to the value's {@link #hashCode}.
|
* delegate to the value's {@link Object#hashCode hashCode}.
|
||||||
*
|
*
|
||||||
* @param x The value for which to retrieve a hash code
|
* @param x The value for which to retrieve a hash code
|
||||||
* @return The hash code
|
* @return The hash code
|
||||||
|
@ -233,7 +234,7 @@ public interface Type extends Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to
|
* Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to
|
||||||
* delegate to the value's {@link #hashCode}.
|
* delegate to the value's {@link Object#hashCode hashCode}.
|
||||||
*
|
*
|
||||||
* @param x The value for which to retrieve a hash code
|
* @param x The value for which to retrieve a hash code
|
||||||
* @param factory The session factory
|
* @param factory The session factory
|
||||||
|
@ -301,97 +302,109 @@ public interface Type extends Serializable {
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve an instance of the mapped class from a JDBC resultset. Implementors
|
* Extract a value of the {@link #getReturnedClass() mapped class} from the JDBC result set. Implementors
|
||||||
* should handle possibility of null values.
|
* should handle possibility of null values.
|
||||||
*
|
*
|
||||||
* @see Type#hydrate(ResultSet, String[], SessionImplementor, Object) alternative, 2-phase property initialization
|
* @param rs The result set from which to extract value.
|
||||||
* @param rs
|
* @param names the column names making up this type value (use to read from result set)
|
||||||
* @param names the column names
|
* @param session The originating session
|
||||||
* @param session
|
|
||||||
* @param owner the parent entity
|
* @param owner the parent entity
|
||||||
* @return Object
|
*
|
||||||
* @throws HibernateException
|
* @return The extracted value
|
||||||
* @throws SQLException
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
* @throws SQLException An error from the JDBC driver
|
||||||
|
*
|
||||||
|
* @see Type#hydrate(ResultSet, String[], SessionImplementor, Object) alternative, 2-phase property initialization
|
||||||
*/
|
*/
|
||||||
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
||||||
throws HibernateException, SQLException;
|
throws HibernateException, SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve an instance of the mapped class from a JDBC resultset. Implementations
|
* Extract a value of the {@link #getReturnedClass() mapped class} from the JDBC result set. Implementors
|
||||||
* should handle possibility of null values. This method might be called if the
|
* should handle possibility of null values. This form might be called if the type is known to be a
|
||||||
* type is known to be a single-column type.
|
* single-column type.
|
||||||
*
|
*
|
||||||
* @param rs
|
* @param rs The result set from which to extract value.
|
||||||
* @param name the column name
|
* @param name the column name making up this type value (use to read from result set)
|
||||||
* @param session
|
* @param session The originating session
|
||||||
* @param owner the parent entity
|
* @param owner the parent entity
|
||||||
* @return Object
|
*
|
||||||
* @throws HibernateException
|
* @return The extracted value
|
||||||
* @throws SQLException
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
* @throws SQLException An error from the JDBC driver
|
||||||
*/
|
*/
|
||||||
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
|
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
|
||||||
throws HibernateException, SQLException;
|
throws HibernateException, SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write an instance of the mapped class to a prepared statement, ignoring some columns.
|
* Bind a value represented by an instance of the {@link #getReturnedClass() mapped class} to the JDBC prepared
|
||||||
* Implementors should handle possibility of null values. A multi-column type should be
|
* statement, ignoring some columns as dictated by the 'settable' parameter. Implementors should handle the
|
||||||
* written to parameters starting from <tt>index</tt>.
|
* possibility of null values. A multi-column type should bind parameters starting from <tt>index</tt>.
|
||||||
* @param st
|
|
||||||
* @param value the object to write
|
|
||||||
* @param index statement parameter index
|
|
||||||
* @param settable an array indicating which columns to ignore
|
|
||||||
* @param session
|
|
||||||
*
|
*
|
||||||
* @throws HibernateException
|
* @param st The JDBC prepared statement to which to bind
|
||||||
* @throws SQLException
|
* @param value the object to write
|
||||||
|
* @param index starting parameter bind index
|
||||||
|
* @param settable an array indicating which columns to bind/ignore
|
||||||
|
* @param session The originating session
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
* @throws SQLException An error from the JDBC driver
|
||||||
*/
|
*/
|
||||||
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session)
|
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session)
|
||||||
throws HibernateException, SQLException;
|
throws HibernateException, SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write an instance of the mapped class to a prepared statement. Implementors
|
* Bind a value represented by an instance of the {@link #getReturnedClass() mapped class} to the JDBC prepared
|
||||||
* should handle possibility of null values. A multi-column type should be written
|
* statement. Implementors should handle possibility of null values. A multi-column type should bind parameters
|
||||||
* to parameters starting from <tt>index</tt>.
|
* starting from <tt>index</tt>.
|
||||||
* @param st
|
|
||||||
* @param value the object to write
|
|
||||||
* @param index statement parameter index
|
|
||||||
* @param session
|
|
||||||
*
|
*
|
||||||
* @throws HibernateException
|
* @param st The JDBC prepared statement to which to bind
|
||||||
* @throws SQLException
|
* @param value the object to write
|
||||||
|
* @param index starting parameter bind index
|
||||||
|
* @param session The originating session
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
* @throws SQLException An error from the JDBC driver
|
||||||
*/
|
*/
|
||||||
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
|
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
|
||||||
throws HibernateException, SQLException;
|
throws HibernateException, SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A representation of the value to be embedded in an XML element.
|
* Generate a representation of the value for logging purposes.
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value The value to be logged
|
||||||
* @param factory
|
* @param factory The session factory
|
||||||
* @return String
|
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
|
||||||
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
|
|
||||||
throws HibernateException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A representation of the value to be embedded in a log file.
|
|
||||||
*
|
*
|
||||||
* @param value
|
* @return The loggable representation
|
||||||
* @param factory
|
*
|
||||||
* @return String
|
* @throws HibernateException An error from Hibernate
|
||||||
* @throws HibernateException
|
|
||||||
*/
|
*/
|
||||||
public String toLoggableString(Object value, SessionFactoryImplementor factory)
|
public String toLoggableString(Object value, SessionFactoryImplementor factory)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the XML representation of an instance.
|
* A representation of the value to be embedded in an XML element.
|
||||||
* @param xml
|
|
||||||
* @param factory
|
|
||||||
*
|
*
|
||||||
* @return an instance of the type
|
* @param node The XML node to which to write the value
|
||||||
* @throws HibernateException
|
* @param value The value to write
|
||||||
|
* @param factory The session factory
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
*/
|
||||||
|
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
|
||||||
|
throws HibernateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the XML representation of an instance.
|
||||||
|
*
|
||||||
|
* @param xml The XML node from which to read the value
|
||||||
|
* @param factory The session factory
|
||||||
|
*
|
||||||
|
* @return an instance of the {@link #getReturnedClass() mapped class}
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException;
|
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException;
|
||||||
|
|
||||||
|
@ -403,12 +416,14 @@ public interface Type extends Serializable {
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a deep copy of the persistent state, stopping at entities and at
|
* Return a deep copy of the persistent state, stopping at entities and at collections.
|
||||||
* collections.
|
|
||||||
*
|
*
|
||||||
* @param value generally a collection element or entity field
|
* @param value The value to be copied
|
||||||
* @param factory
|
* @param factory The session factory
|
||||||
* @return Object a copy
|
*
|
||||||
|
* @return The deep copy
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Object deepCopy(Object value, SessionFactoryImplementor factory)
|
public Object deepCopy(Object value, SessionFactoryImplementor factory)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
@ -423,20 +438,30 @@ public interface Type extends Serializable {
|
||||||
public boolean isMutable();
|
public boolean isMutable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a cacheable "disassembled" representation of the object.
|
* Return a disassembled representation of the object. This is the value Hibernate will use in second level
|
||||||
|
* caching, so care should be taken to break values down to their simplest forms; for entities especially, this
|
||||||
|
* means breaking them down into their constituent parts.
|
||||||
|
*
|
||||||
* @param value the value to cache
|
* @param value the value to cache
|
||||||
* @param session the session
|
* @param session the originating session
|
||||||
* @param owner optional parent entity object (needed for collections)
|
* @param owner optional parent entity object (needed for collections)
|
||||||
|
*
|
||||||
* @return the disassembled, deep cloned state
|
* @return the disassembled, deep cloned state
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException;
|
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reconstruct the object from its cached "disassembled" state.
|
* Reconstruct the object from its disassembled state. This method is the reciprocal of {@link #disassemble}
|
||||||
|
*
|
||||||
* @param cached the disassembled state from the cache
|
* @param cached the disassembled state from the cache
|
||||||
* @param session the session
|
* @param session the originating session
|
||||||
* @param owner the parent entity object
|
* @param owner the parent entity object
|
||||||
* @return the the object
|
*
|
||||||
|
* @return the (re)assembled object
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Object assemble(Serializable cached, SessionImplementor session, Object owner)
|
public Object assemble(Serializable cached, SessionImplementor session, Object owner)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
@ -444,49 +469,75 @@ public interface Type extends Serializable {
|
||||||
/**
|
/**
|
||||||
* Called before assembling a query result set from the query cache, to allow batch fetching
|
* Called before assembling a query result set from the query cache, to allow batch fetching
|
||||||
* of entities missing from the second-level cache.
|
* of entities missing from the second-level cache.
|
||||||
|
*
|
||||||
|
* @param cached The key
|
||||||
|
* @param session The originating session
|
||||||
*/
|
*/
|
||||||
public void beforeAssemble(Serializable cached, SessionImplementor session);
|
public void beforeAssemble(Serializable cached, SessionImplementor session);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve an instance of the mapped class, or the identifier of an entity or collection,
|
* Extract a value from the JDBC result set. This is useful for 2-phase property initialization - the second
|
||||||
* from a JDBC resultset. This is useful for 2-phase property initialization - the second
|
* phase is a call to {@link #resolve}
|
||||||
* phase is a call to <tt>resolveIdentifier()</tt>.
|
* This hydrated value will be either:<ul>
|
||||||
|
* <li>in the case of an entity or collection type, the key</li>
|
||||||
|
* <li>otherwise, the value itself</li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @see Type#resolve(Object, SessionImplementor, Object)
|
* @param rs The JDBC result set
|
||||||
* @param rs
|
* @param names the column names making up this type value (use to read from result set)
|
||||||
* @param names the column names
|
* @param session The originating session
|
||||||
* @param session the session
|
|
||||||
* @param owner the parent entity
|
* @param owner the parent entity
|
||||||
* @return Object an identifier or actual value
|
*
|
||||||
* @throws HibernateException
|
* @return An entity or collection key, or an actual value.
|
||||||
* @throws SQLException
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
* @throws SQLException An error from the JDBC driver
|
||||||
|
*
|
||||||
|
* @see #resolve
|
||||||
*/
|
*/
|
||||||
public Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
public Object hydrate(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
||||||
throws HibernateException, SQLException;
|
throws HibernateException, SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map identifiers to entities or collections. This is the second phase of 2-phase property
|
* The second phase of 2-phase loading. Only really pertinent for entities and collections. Here we resolve the
|
||||||
* initialization.
|
* identifier to an entity or collection instance
|
||||||
*
|
*
|
||||||
* @see Type#hydrate(ResultSet, String[], SessionImplementor, Object)
|
|
||||||
* @param value an identifier or value returned by <tt>hydrate()</tt>
|
* @param value an identifier or value returned by <tt>hydrate()</tt>
|
||||||
* @param owner the parent entity
|
* @param owner the parent entity
|
||||||
* @param session the session
|
* @param session the session
|
||||||
|
*
|
||||||
* @return the given value, or the value associated with the identifier
|
* @return the given value, or the value associated with the identifier
|
||||||
* @throws HibernateException
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
|
*
|
||||||
|
* @see #hydrate
|
||||||
*/
|
*/
|
||||||
public Object resolve(Object value, SessionImplementor session, Object owner)
|
public Object resolve(Object value, SessionImplementor session, Object owner)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a hydrated, but unresolved value, return a value that may be used to
|
* Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref
|
||||||
* reconstruct property-ref associations.
|
* associations.
|
||||||
|
*
|
||||||
|
* @param value The unresolved, hydrated value
|
||||||
|
* @param session THe originating session
|
||||||
|
* @param owner The value owner
|
||||||
|
*
|
||||||
|
* @return The semi-resolved value
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Object semiResolve(Object value, SessionImplementor session, Object owner)
|
public Object semiResolve(Object value, SessionImplementor session, Object owner)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the type of a semi-resolved value.
|
* As part of 2-phase loading, when we perform resolving what is the resolved type for this type? Generally
|
||||||
|
* speaking the type and its semi-resolved type will be the same. The main deviation from this is in the
|
||||||
|
* case of an entity where the type would be the entity type and semi-resolved type would be its identifier type
|
||||||
|
*
|
||||||
|
* @param factory The session factory
|
||||||
|
*
|
||||||
|
* @return The semi-resolved type
|
||||||
*/
|
*/
|
||||||
public Type getSemiResolvedType(SessionFactoryImplementor factory);
|
public Type getSemiResolvedType(SessionFactoryImplementor factory);
|
||||||
|
|
||||||
|
@ -499,15 +550,20 @@ public interface Type extends Serializable {
|
||||||
*
|
*
|
||||||
* @param original the value from the detached entity being merged
|
* @param original the value from the detached entity being merged
|
||||||
* @param target the value in the managed entity
|
* @param target the value in the managed entity
|
||||||
|
* @param session The originating session
|
||||||
|
* @param owner The owner of the value
|
||||||
|
* @param copyCache The cache of already copied/replaced values
|
||||||
|
*
|
||||||
* @return the value to be merged
|
* @return the value to be merged
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Object replace(
|
public Object replace(
|
||||||
Object original,
|
Object original,
|
||||||
Object target,
|
Object target,
|
||||||
SessionImplementor session,
|
SessionImplementor session,
|
||||||
Object owner,
|
Object owner,
|
||||||
Map copyCache)
|
Map copyCache) throws HibernateException;
|
||||||
throws HibernateException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* During merge, replace the existing (target) value in the entity we are merging to
|
* During merge, replace the existing (target) value in the entity we are merging to
|
||||||
|
@ -518,7 +574,14 @@ public interface Type extends Serializable {
|
||||||
*
|
*
|
||||||
* @param original the value from the detached entity being merged
|
* @param original the value from the detached entity being merged
|
||||||
* @param target the value in the managed entity
|
* @param target the value in the managed entity
|
||||||
|
* @param session The originating session
|
||||||
|
* @param owner The owner of the value
|
||||||
|
* @param copyCache The cache of already copied/replaced values
|
||||||
|
* @param foreignKeyDirection For associations, which direction does the foreign key point?
|
||||||
|
*
|
||||||
* @return the value to be merged
|
* @return the value to be merged
|
||||||
|
*
|
||||||
|
* @throws HibernateException An error from Hibernate
|
||||||
*/
|
*/
|
||||||
public Object replace(
|
public Object replace(
|
||||||
Object original,
|
Object original,
|
||||||
|
@ -526,14 +589,16 @@ public interface Type extends Serializable {
|
||||||
SessionImplementor session,
|
SessionImplementor session,
|
||||||
Object owner,
|
Object owner,
|
||||||
Map copyCache,
|
Map copyCache,
|
||||||
ForeignKeyDirection foreignKeyDirection)
|
ForeignKeyDirection foreignKeyDirection) throws HibernateException;
|
||||||
throws HibernateException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an instance of the type, return an array of boolean, indicating
|
* Given an instance of the type, return an array of boolean, indicating
|
||||||
* which mapped columns would be null.
|
* which mapped columns would be null.
|
||||||
*
|
*
|
||||||
* @param value an instance of the type
|
* @param value an instance of the type
|
||||||
|
* @param mapping The mapping abstraction
|
||||||
|
*
|
||||||
|
* @return array indicating column nullness for a value instance
|
||||||
*/
|
*/
|
||||||
public boolean[] toColumnNullness(Object value, Mapping mapping);
|
public boolean[] toColumnNullness(Object value, Mapping mapping);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public interface SqlTypeDescriptor extends Serializable {
|
||||||
/**
|
/**
|
||||||
* Is this descriptor available for remapping?
|
* Is this descriptor available for remapping?
|
||||||
*
|
*
|
||||||
* @return
|
* @return {@code true} indicates this descriptor can be remapped; otherwise, {@code false}
|
||||||
*
|
*
|
||||||
* @see org.hibernate.type.descriptor.WrapperOptions#remapSqlTypeDescriptor
|
* @see org.hibernate.type.descriptor.WrapperOptions#remapSqlTypeDescriptor
|
||||||
* @see org.hibernate.dialect.Dialect#remapSqlTypeDescriptor
|
* @see org.hibernate.dialect.Dialect#remapSqlTypeDescriptor
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* 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
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -32,7 +34,8 @@ import org.hibernate.Session;
|
||||||
public interface HibernateEntityManager extends EntityManager {
|
public interface HibernateEntityManager extends EntityManager {
|
||||||
/**
|
/**
|
||||||
* Retrieve a reference to the Hibernate {@link Session} used by this {@link EntityManager}.
|
* Retrieve a reference to the Hibernate {@link Session} used by this {@link EntityManager}.
|
||||||
* @return
|
*
|
||||||
|
* @return The session
|
||||||
*/
|
*/
|
||||||
public Session getSession();
|
public Session getSession();
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,17 +88,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return getAlias();
|
return getAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canBeDereferenced() {
|
protected boolean canBeDereferenced() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void prepareAlias(CriteriaQueryCompiler.RenderingContext renderingContext) {
|
public void prepareAlias(CriteriaQueryCompiler.RenderingContext renderingContext) {
|
||||||
if ( getAlias() == null ) {
|
if ( getAlias() == null ) {
|
||||||
if ( isCorrelated() ) {
|
if ( isCorrelated() ) {
|
||||||
|
@ -121,23 +116,16 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return renderProjection( renderingContext );
|
return renderProjection( renderingContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Attribute<?, ?> getAttribute() {
|
public Attribute<?, ?> getAttribute() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public From<?, Z> getParent() {
|
public From<?, Z> getParent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
protected Attribute<X, ?> locateAttributeInternal(String name) {
|
protected Attribute<X, ?> locateAttributeInternal(String name) {
|
||||||
return (Attribute<X, ?>) locateManagedType().getAttribute( name );
|
return (Attribute<X, ?>) locateManagedType().getAttribute( name );
|
||||||
|
@ -170,6 +158,7 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class BasicJoinScope implements JoinScope<X> {
|
protected class BasicJoinScope implements JoinScope<X> {
|
||||||
|
@Override
|
||||||
public void addJoin(Join<X, ?> join) {
|
public void addJoin(Join<X, ?> join) {
|
||||||
if ( joins == null ) {
|
if ( joins == null ) {
|
||||||
joins = new LinkedHashSet<Join<X,?>>();
|
joins = new LinkedHashSet<Join<X,?>>();
|
||||||
|
@ -177,6 +166,7 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
joins.add( join );
|
joins.add( join );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addFetch(Fetch<X, ?> fetch) {
|
public void addFetch(Fetch<X, ?> fetch) {
|
||||||
if ( fetches == null ) {
|
if ( fetches == null ) {
|
||||||
fetches = new LinkedHashSet<Fetch<X,?>>();
|
fetches = new LinkedHashSet<Fetch<X,?>>();
|
||||||
|
@ -186,6 +176,7 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class CorrelationJoinScope implements JoinScope<X> {
|
protected class CorrelationJoinScope implements JoinScope<X> {
|
||||||
|
@Override
|
||||||
public void addJoin(Join<X, ?> join) {
|
public void addJoin(Join<X, ?> join) {
|
||||||
if ( joins == null ) {
|
if ( joins == null ) {
|
||||||
joins = new LinkedHashSet<Join<X,?>>();
|
joins = new LinkedHashSet<Join<X,?>>();
|
||||||
|
@ -193,28 +184,23 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
joins.add( join );
|
joins.add( join );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addFetch(Fetch<X, ?> fetch) {
|
public void addFetch(Fetch<X, ?> fetch) {
|
||||||
throw new UnsupportedOperationException( "Cannot define fetch from a subquery correlation" );
|
throw new UnsupportedOperationException( "Cannot define fetch from a subquery correlation" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isCorrelated() {
|
public boolean isCorrelated() {
|
||||||
return getCorrelationParent() != null;
|
return getCorrelationParent() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public FromImplementor<Z,X> getCorrelationParent() {
|
public FromImplementor<Z,X> getCorrelationParent() {
|
||||||
return correlationParent;
|
return correlationParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public FromImplementor<Z, X> correlateTo(CriteriaSubqueryImpl subquery) {
|
public FromImplementor<Z, X> correlateTo(CriteriaSubqueryImpl subquery) {
|
||||||
final FromImplementor<Z, X> correlationDelegate = createCorrelationDelegate();
|
final FromImplementor<Z, X> correlationDelegate = createCorrelationDelegate();
|
||||||
|
@ -224,6 +210,7 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
|
|
||||||
protected abstract FromImplementor<Z, X> createCorrelationDelegate();
|
protected abstract FromImplementor<Z, X> createCorrelationDelegate();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void prepareCorrelationDelegate(FromImplementor<Z, X> parent) {
|
public void prepareCorrelationDelegate(FromImplementor<Z, X> parent) {
|
||||||
this.joinScope = new CorrelationJoinScope();
|
this.joinScope = new CorrelationJoinScope();
|
||||||
this.correlationParent = parent;
|
this.correlationParent = parent;
|
||||||
|
@ -244,9 +231,7 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public Set<Join<X, ?>> getJoins() {
|
public Set<Join<X, ?>> getJoins() {
|
||||||
return joins == null
|
return joins == null
|
||||||
|
@ -254,16 +239,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
: joins;
|
: joins;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> Join<X, Y> join(SingularAttribute<? super X, Y> singularAttribute) {
|
public <Y> Join<X, Y> join(SingularAttribute<? super X, Y> singularAttribute) {
|
||||||
return join( singularAttribute, DEFAULT_JOIN_TYPE );
|
return join( singularAttribute, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> Join<X, Y> join(SingularAttribute<? super X, Y> attribute, JoinType jt) {
|
public <Y> Join<X, Y> join(SingularAttribute<? super X, Y> attribute, JoinType jt) {
|
||||||
if ( ! canBeJoinSource() ) {
|
if ( ! canBeJoinSource() ) {
|
||||||
throw illegalJoin();
|
throw illegalJoin();
|
||||||
|
@ -294,16 +275,13 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
jt
|
jt
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
@Override
|
||||||
*/
|
|
||||||
public <Y> CollectionJoin<X, Y> join(CollectionAttribute<? super X, Y> collection) {
|
public <Y> CollectionJoin<X, Y> join(CollectionAttribute<? super X, Y> collection) {
|
||||||
return join( collection, DEFAULT_JOIN_TYPE );
|
return join( collection, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> CollectionJoin<X, Y> join(CollectionAttribute<? super X, Y> collection, JoinType jt) {
|
public <Y> CollectionJoin<X, Y> join(CollectionAttribute<? super X, Y> collection, JoinType jt) {
|
||||||
if ( ! canBeJoinSource() ) {
|
if ( ! canBeJoinSource() ) {
|
||||||
throw illegalJoin();
|
throw illegalJoin();
|
||||||
|
@ -331,16 +309,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> SetJoin<X, Y> join(SetAttribute<? super X, Y> set) {
|
public <Y> SetJoin<X, Y> join(SetAttribute<? super X, Y> set) {
|
||||||
return join( set, DEFAULT_JOIN_TYPE );
|
return join( set, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> SetJoin<X, Y> join(SetAttribute<? super X, Y> set, JoinType jt) {
|
public <Y> SetJoin<X, Y> join(SetAttribute<? super X, Y> set, JoinType jt) {
|
||||||
if ( ! canBeJoinSource() ) {
|
if ( ! canBeJoinSource() ) {
|
||||||
throw illegalJoin();
|
throw illegalJoin();
|
||||||
|
@ -362,16 +336,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return new SetAttributeJoin<X,Y>( criteriaBuilder(), attributeType, this, set, jt );
|
return new SetAttributeJoin<X,Y>( criteriaBuilder(), attributeType, this, set, jt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> ListJoin<X, Y> join(ListAttribute<? super X, Y> list) {
|
public <Y> ListJoin<X, Y> join(ListAttribute<? super X, Y> list) {
|
||||||
return join( list, DEFAULT_JOIN_TYPE );
|
return join( list, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <Y> ListJoin<X, Y> join(ListAttribute<? super X, Y> list, JoinType jt) {
|
public <Y> ListJoin<X, Y> join(ListAttribute<? super X, Y> list, JoinType jt) {
|
||||||
if ( ! canBeJoinSource() ) {
|
if ( ! canBeJoinSource() ) {
|
||||||
throw illegalJoin();
|
throw illegalJoin();
|
||||||
|
@ -393,16 +363,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return new ListAttributeJoin<X,Y>( criteriaBuilder(), attributeType, this, list, jt );
|
return new ListAttributeJoin<X,Y>( criteriaBuilder(), attributeType, this, list, jt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map) {
|
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map) {
|
||||||
return join( map, DEFAULT_JOIN_TYPE );
|
return join( map, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map, JoinType jt) {
|
public <K, V> MapJoin<X, K, V> join(MapAttribute<? super X, K, V> map, JoinType jt) {
|
||||||
if ( ! canBeJoinSource() ) {
|
if ( ! canBeJoinSource() ) {
|
||||||
throw illegalJoin();
|
throw illegalJoin();
|
||||||
|
@ -424,16 +390,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return new MapAttributeJoin<X, K, V>( criteriaBuilder(), attributeType, this, map, jt );
|
return new MapAttributeJoin<X, K, V>( criteriaBuilder(), attributeType, this, map, jt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <X,Y> Join<X, Y> join(String attributeName) {
|
public <X,Y> Join<X, Y> join(String attributeName) {
|
||||||
return join( attributeName, DEFAULT_JOIN_TYPE );
|
return join( attributeName, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X,Y> Join<X, Y> join(String attributeName, JoinType jt) {
|
public <X,Y> Join<X, Y> join(String attributeName, JoinType jt) {
|
||||||
if ( ! canBeJoinSource() ) {
|
if ( ! canBeJoinSource() ) {
|
||||||
|
@ -465,16 +427,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <X,Y> CollectionJoin<X, Y> joinCollection(String attributeName) {
|
public <X,Y> CollectionJoin<X, Y> joinCollection(String attributeName) {
|
||||||
return joinCollection( attributeName, DEFAULT_JOIN_TYPE );
|
return joinCollection( attributeName, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X,Y> CollectionJoin<X, Y> joinCollection(String attributeName, JoinType jt) {
|
public <X,Y> CollectionJoin<X, Y> joinCollection(String attributeName, JoinType jt) {
|
||||||
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
||||||
|
@ -490,16 +448,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return (CollectionJoin<X,Y>) join( (CollectionAttribute) attribute, jt );
|
return (CollectionJoin<X,Y>) join( (CollectionAttribute) attribute, jt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <X,Y> SetJoin<X, Y> joinSet(String attributeName) {
|
public <X,Y> SetJoin<X, Y> joinSet(String attributeName) {
|
||||||
return joinSet( attributeName, DEFAULT_JOIN_TYPE );
|
return joinSet( attributeName, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X,Y> SetJoin<X, Y> joinSet(String attributeName, JoinType jt) {
|
public <X,Y> SetJoin<X, Y> joinSet(String attributeName, JoinType jt) {
|
||||||
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
||||||
|
@ -515,16 +469,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return (SetJoin<X,Y>) join( (SetAttribute) attribute, jt );
|
return (SetJoin<X,Y>) join( (SetAttribute) attribute, jt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <X,Y> ListJoin<X, Y> joinList(String attributeName) {
|
public <X,Y> ListJoin<X, Y> joinList(String attributeName) {
|
||||||
return joinList( attributeName, DEFAULT_JOIN_TYPE );
|
return joinList( attributeName, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X,Y> ListJoin<X, Y> joinList(String attributeName, JoinType jt) {
|
public <X,Y> ListJoin<X, Y> joinList(String attributeName, JoinType jt) {
|
||||||
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
||||||
|
@ -540,16 +490,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return (ListJoin<X,Y>) join( (ListAttribute) attribute, jt );
|
return (ListJoin<X,Y>) join( (ListAttribute) attribute, jt );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName) {
|
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName) {
|
||||||
return joinMap( attributeName, DEFAULT_JOIN_TYPE );
|
return joinMap( attributeName, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName, JoinType jt) {
|
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName, JoinType jt) {
|
||||||
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
final Attribute<X,?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
|
||||||
|
@ -579,9 +525,7 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public Set<Fetch<X, ?>> getFetches() {
|
public Set<Fetch<X, ?>> getFetches() {
|
||||||
return fetches == null
|
return fetches == null
|
||||||
|
@ -589,10 +533,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
: fetches;
|
: fetches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> singularAttribute) {
|
public <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> singularAttribute) {
|
||||||
return fetch( singularAttribute, DEFAULT_JOIN_TYPE );
|
return fetch( singularAttribute, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> attribute, JoinType jt) {
|
public <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> attribute, JoinType jt) {
|
||||||
if ( ! canBeFetchSource() ) {
|
if ( ! canBeFetchSource() ) {
|
||||||
throw illegalFetch();
|
throw illegalFetch();
|
||||||
|
@ -603,10 +549,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return fetch;
|
return fetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> pluralAttribute) {
|
public <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> pluralAttribute) {
|
||||||
return fetch( pluralAttribute, DEFAULT_JOIN_TYPE );
|
return fetch( pluralAttribute, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> pluralAttribute, JoinType jt) {
|
public <Y> Fetch<X, Y> fetch(PluralAttribute<? super X, ?, Y> pluralAttribute, JoinType jt) {
|
||||||
if ( ! canBeFetchSource() ) {
|
if ( ! canBeFetchSource() ) {
|
||||||
throw illegalFetch();
|
throw illegalFetch();
|
||||||
|
@ -630,10 +578,12 @@ public abstract class AbstractFromImpl<Z,X>
|
||||||
return fetch;
|
return fetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <X,Y> Fetch<X, Y> fetch(String attributeName) {
|
public <X,Y> Fetch<X, Y> fetch(String attributeName) {
|
||||||
return fetch( attributeName, DEFAULT_JOIN_TYPE );
|
return fetch( attributeName, DEFAULT_JOIN_TYPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X,Y> Fetch<X, Y> fetch(String attributeName, JoinType jt) {
|
public <X,Y> Fetch<X, Y> fetch(String attributeName, JoinType jt) {
|
||||||
if ( ! canBeFetchSource() ) {
|
if ( ! canBeFetchSource() ) {
|
||||||
|
|
|
@ -34,8 +34,10 @@ public class AuditEntityNameRegister {
|
||||||
/**
|
/**
|
||||||
* Creates a unique (not yet registered) audit entity name by appending consecutive numbers to the base
|
* Creates a unique (not yet registered) audit entity name by appending consecutive numbers to the base
|
||||||
* name. If the base name is not yet used, it is returned unmodified.
|
* name. If the base name is not yet used, it is returned unmodified.
|
||||||
|
*
|
||||||
* @param baseAuditEntityName The base entity name.
|
* @param baseAuditEntityName The base entity name.
|
||||||
* @return
|
*
|
||||||
|
* @return A unique audit entity name
|
||||||
*/
|
*/
|
||||||
public String createUnique(final String baseAuditEntityName) {
|
public String createUnique(final String baseAuditEntityName) {
|
||||||
String auditEntityName = baseAuditEntityName;
|
String auditEntityName = baseAuditEntityName;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* 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
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -73,10 +73,10 @@ public class FirstLevelCache {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the entityName into the cache. The key is a triple make with primaryKey, revision and entity
|
* Adds the entityName into the cache. The key is a triple make with primaryKey, revision and entity
|
||||||
* @param id, primaryKey
|
* @param id primaryKey
|
||||||
* @param revision, revision number
|
* @param revision revision number
|
||||||
* @param entity, object retrieved by envers
|
* @param entity object retrieved by envers
|
||||||
* @param entityName, value of the cache
|
* @param entityName value of the cache
|
||||||
*/
|
*/
|
||||||
public void putOnEntityNameCache(Object id, Number revision, Object entity, String entityName) {
|
public void putOnEntityNameCache(Object id, Number revision, Object entity, String entityName) {
|
||||||
LOG.debugf("Caching entityName on First Level Cache: - primaryKey:%s - revision:%s - entity:%s -> entityName:%s",
|
LOG.debugf("Caching entityName on First Level Cache: - primaryKey:%s - revision:%s - entity:%s -> entityName:%s",
|
||||||
|
@ -89,9 +89,12 @@ public class FirstLevelCache {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the entityName from the cache. The key is a triple make with primaryKey, revision and entity
|
* Gets the entityName from the cache. The key is a triple make with primaryKey, revision and entity
|
||||||
* @param id, primaryKey
|
*
|
||||||
* @param revision, revision number
|
* @param id primaryKey
|
||||||
* @param entity, object retrieved by envers
|
* @param revision revision number
|
||||||
|
* @param entity object retrieved by envers
|
||||||
|
*
|
||||||
|
* @return The appropriate entity name
|
||||||
*/
|
*/
|
||||||
public String getFromEntityNameCache(Object id, Number revision, Object entity) {
|
public String getFromEntityNameCache(Object id, Number revision, Object entity) {
|
||||||
LOG.debugf("Trying to resolve entityName from First Level Cache: - primaryKey:%s - revision:%s - entity:%s",
|
LOG.debugf("Trying to resolve entityName from First Level Cache: - primaryKey:%s - revision:%s - entity:%s",
|
||||||
|
|
|
@ -36,8 +36,9 @@ public interface DialectCheck {
|
||||||
/**
|
/**
|
||||||
* Does the given dialect match the defined check?
|
* Does the given dialect match the defined check?
|
||||||
*
|
*
|
||||||
* @param dialect
|
* @param dialect The dialect against which to check
|
||||||
* @return
|
*
|
||||||
|
* @return {@code true} if it matches; {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isMatch(Dialect dialect);
|
public boolean isMatch(Dialect dialect);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import java.lang.annotation.Target;
|
||||||
* Annotation used to identify a method as a callback to be executed whenever a {@link FailureExpected} is handled.
|
* Annotation used to identify a method as a callback to be executed whenever a {@link FailureExpected} is handled.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @see
|
|
||||||
*/
|
*/
|
||||||
@Retention( RetentionPolicy.RUNTIME )
|
@Retention( RetentionPolicy.RUNTIME )
|
||||||
@Target( ElementType.METHOD )
|
@Target( ElementType.METHOD )
|
||||||
|
|
|
@ -12,20 +12,25 @@ ideaModule {
|
||||||
|
|
||||||
javadocBuildDir = dir( buildDirName + "/documentation/javadocs" )
|
javadocBuildDir = dir( buildDirName + "/documentation/javadocs" )
|
||||||
|
|
||||||
def List subProjectsToSkipForJavadoc = ['release','documentation'];
|
|
||||||
def List sourceSetsToSkipForJavadoc = ['test','matrix'];
|
|
||||||
|
|
||||||
def copyRightYear = new java.util.GregorianCalendar().get( java.util.Calendar.YEAR );
|
def copyRightYear = new java.util.GregorianCalendar().get( java.util.Calendar.YEAR );
|
||||||
|
|
||||||
task aggregateJavadocs(type: Javadoc) {
|
task aggregateJavadocs(type: Javadoc) {
|
||||||
|
// exclude any generated sources (this is not working: http://forums.gradle.org/gradle/topics/excluding_generated_source_from_javadoc)
|
||||||
|
exclude "**/generated-src/**"
|
||||||
|
|
||||||
|
// process each project, building up:
|
||||||
|
// 1) appropriate sources
|
||||||
|
// 2) classpath
|
||||||
|
// 3) the package list for groups
|
||||||
Set<String> apiPackages = new HashSet<String>()
|
Set<String> apiPackages = new HashSet<String>()
|
||||||
Set<String> spiPackages = new HashSet<String>()
|
Set<String> spiPackages = new HashSet<String>()
|
||||||
Set<String> internalPackages = new HashSet<String>()
|
Set<String> internalPackages = new HashSet<String>()
|
||||||
|
parent.subprojects.each{ Project subProject->
|
||||||
parent.subprojects.each{ subProject->
|
// skip certain sub-projects
|
||||||
if ( !subProjectsToSkipForJavadoc.contains( subProject.name ) ) {
|
if ( ! ['release','documentation'].contains( subProject.name ) ) {
|
||||||
subProject.sourceSets.each { sourceSet ->
|
subProject.sourceSets.each { SourceSet sourceSet ->
|
||||||
if ( !sourceSetsToSkipForJavadoc.contains( sourceSet.name ) ) {
|
// skip certain source sets
|
||||||
|
if ( ! ['test','matrix'].contains( sourceSet.name ) ) {
|
||||||
source sourceSet.java
|
source sourceSet.java
|
||||||
|
|
||||||
if( classpath ) {
|
if( classpath ) {
|
||||||
|
@ -43,6 +48,9 @@ task aggregateJavadocs(type: Javadoc) {
|
||||||
else if ( packageName.endsWith( ".spi" ) || packageName.contains( ".spi." ) ) {
|
else if ( packageName.endsWith( ".spi" ) || packageName.contains( ".spi." ) ) {
|
||||||
spiPackages.add( packageName );
|
spiPackages.add( packageName );
|
||||||
}
|
}
|
||||||
|
else if ( packageName.startsWith( "org.hibernate.testing" ) ) {
|
||||||
|
// do nothing as testing support is already handled...
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
apiPackages.add( packageName );
|
apiPackages.add( packageName );
|
||||||
}
|
}
|
||||||
|
@ -52,11 +60,12 @@ task aggregateJavadocs(type: Javadoc) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// apply standard config
|
||||||
description = "Build the aggregated JavaDocs for all modules"
|
description = "Build the aggregated JavaDocs for all modules"
|
||||||
maxMemory = '512m'
|
maxMemory = '512m'
|
||||||
destinationDir = javadocBuildDir.dir
|
destinationDir = javadocBuildDir.dir
|
||||||
configure( options ) {
|
configure( options ) {
|
||||||
overview = new File( projectDir, 'src/javadoc/package.html' )
|
overview = new File( projectDir, 'src/javadoc/overview.html' )
|
||||||
stylesheetFile = new File( projectDir, 'src/javadoc/stylesheet.css' )
|
stylesheetFile = new File( projectDir, 'src/javadoc/stylesheet.css' )
|
||||||
windowTitle = 'Hibernate JavaDocs'
|
windowTitle = 'Hibernate JavaDocs'
|
||||||
docTitle = "Hibernate JavaDoc ($project.version)"
|
docTitle = "Hibernate JavaDoc ($project.version)"
|
||||||
|
@ -67,6 +76,10 @@ task aggregateJavadocs(type: Javadoc) {
|
||||||
group( 'SPI', spiPackages.asList() )
|
group( 'SPI', spiPackages.asList() )
|
||||||
group( 'Internal', internalPackages.asList() )
|
group( 'Internal', internalPackages.asList() )
|
||||||
group ( 'Testing Support', ['org.hibernate.testing*'] )
|
group ( 'Testing Support', ['org.hibernate.testing*'] )
|
||||||
|
// ugh, http://issues.gradle.org/browse/GRADLE-1563
|
||||||
|
// tags ["todo:X"]
|
||||||
|
// work around:
|
||||||
|
addStringOption( "tag", "todo:X" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ This documentation groups packages into the following 3 categories:<ul>
|
||||||
between releases whereas APIs and SPIs are more stable.
|
between releases whereas APIs and SPIs are more stable.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Additionally, we highlight a 4th category
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
Complete Hibernate documentation may be found online at <a href="http://docs.jboss.org/hibernate/">http://docs.jboss.org/hibernate/</a>
|
Complete Hibernate documentation may be found online at <a href="http://docs.jboss.org/hibernate/">http://docs.jboss.org/hibernate/</a>
|
Loading…
Reference in New Issue