Replace <code> with {@code} throughout Javadoc
Issue: SPR-10128
This commit is contained in:
@@ -112,7 +112,7 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
* <p>A further benefit of this option is that <i>plain Sessions opened directly
|
||||
* via the SessionFactory</i>, outside of Spring's Hibernate support, will still
|
||||
* participate in active Spring-managed transactions. However, consider using
|
||||
* Hibernate's <code>getCurrentSession()</code> method instead (see javadoc of
|
||||
* Hibernate's {@code getCurrentSession()} method instead (see javadoc of
|
||||
* "exposeTransactionAwareSessionFactory" property).
|
||||
* <p><b>WARNING:</b> When using a transaction-aware JDBC DataSource in combination
|
||||
* with OpenSessionInViewFilter/Interceptor, whether participating in JTA or
|
||||
@@ -147,17 +147,17 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
|
||||
/**
|
||||
* Set whether to expose a transaction-aware current Session from the
|
||||
* SessionFactory's <code>getCurrentSession()</code> method, returning the
|
||||
* SessionFactory's {@code getCurrentSession()} method, returning the
|
||||
* Session that's associated with the current Spring-managed transaction, if any.
|
||||
* <p>Default is "true", letting data access code work with the plain
|
||||
* Hibernate SessionFactory and its <code>getCurrentSession()</code> method,
|
||||
* Hibernate SessionFactory and its {@code getCurrentSession()} method,
|
||||
* while still being able to participate in current Spring-managed transactions:
|
||||
* with any transaction management strategy, either local or JTA / EJB CMT,
|
||||
* and any transaction synchronization mechanism, either Spring or JTA.
|
||||
* Furthermore, <code>getCurrentSession()</code> will also seamlessly work with
|
||||
* Furthermore, {@code getCurrentSession()} will also seamlessly work with
|
||||
* a request-scoped Session managed by OpenSessionInViewFilter/Interceptor.
|
||||
* <p>Turn this flag off to expose the plain Hibernate SessionFactory with
|
||||
* Hibernate's default <code>getCurrentSession()</code> behavior, supporting
|
||||
* Hibernate's default {@code getCurrentSession()} behavior, supporting
|
||||
* plain JTA synchronization only. Alternatively, simply override the
|
||||
* corresponding Hibernate property "hibernate.current_session_context_class".
|
||||
* @see SpringSessionContext
|
||||
@@ -206,7 +206,7 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
/**
|
||||
* Return the exposed SessionFactory.
|
||||
* Will throw an exception if not initialized yet.
|
||||
* @return the SessionFactory (never <code>null</code>)
|
||||
* @return the SessionFactory (never {@code null})
|
||||
* @throws IllegalStateException if the SessionFactory has not been initialized yet
|
||||
*/
|
||||
protected final SessionFactory getSessionFactory() {
|
||||
@@ -257,7 +257,7 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
/**
|
||||
* Hook that allows post-processing after the SessionFactory has been
|
||||
* successfully created. The SessionFactory is already available through
|
||||
* <code>getSessionFactory()</code> at this point.
|
||||
* {@code getSessionFactory()} at this point.
|
||||
* <p>This implementation is empty.
|
||||
* @throws Exception in case of initialization failure
|
||||
* @see #getSessionFactory()
|
||||
@@ -268,7 +268,7 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
/**
|
||||
* Hook that allows shutdown processing before the SessionFactory
|
||||
* will be closed. The SessionFactory is still available through
|
||||
* <code>getSessionFactory()</code> at this point.
|
||||
* {@code getSessionFactory()} at this point.
|
||||
* <p>This implementation is empty.
|
||||
* @see #getSessionFactory()
|
||||
*/
|
||||
|
||||
@@ -194,7 +194,7 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current Hibernate entity interceptor, or <code>null</code> if none.
|
||||
* Return the current Hibernate entity interceptor, or {@code null} if none.
|
||||
* Resolves an entity interceptor bean name via the bean factory,
|
||||
* if necessary.
|
||||
* @throws IllegalStateException if bean name specified but no bean factory set
|
||||
@@ -322,7 +322,7 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory
|
||||
* @param session the current Hibernate Session
|
||||
* @param existingTransaction if executing within an existing transaction
|
||||
* @return the previous flush mode to restore after the operation,
|
||||
* or <code>null</code> if none
|
||||
* or {@code null} if none
|
||||
* @see #setFlushMode
|
||||
* @see org.hibernate.Session#setFlushMode
|
||||
*/
|
||||
@@ -394,7 +394,7 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory
|
||||
|
||||
/**
|
||||
* Convert the given HibernateException to an appropriate exception
|
||||
* from the <code>org.springframework.dao</code> hierarchy.
|
||||
* from the {@code org.springframework.dao} hierarchy.
|
||||
* <p>Will automatically apply a specified SQLExceptionTranslator to a
|
||||
* Hibernate JDBCException, else rely on Hibernate's default translation.
|
||||
* @param ex HibernateException that occured
|
||||
@@ -414,7 +414,7 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory
|
||||
|
||||
/**
|
||||
* Convert the given Hibernate JDBCException to an appropriate exception
|
||||
* from the <code>org.springframework.dao</code> hierarchy, using the
|
||||
* from the {@code org.springframework.dao} hierarchy, using the
|
||||
* given SQLExceptionTranslator.
|
||||
* @param ex Hibernate JDBCException that occured
|
||||
* @param translator the SQLExceptionTranslator to use
|
||||
@@ -426,9 +426,9 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory
|
||||
|
||||
/**
|
||||
* Convert the given SQLException to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy. Can be overridden in subclasses.
|
||||
* {@code org.springframework.dao} hierarchy. Can be overridden in subclasses.
|
||||
* <p>Note that a direct SQLException can just occur when callback code
|
||||
* performs direct JDBC access via <code>Session.connection()</code>.
|
||||
* performs direct JDBC access via {@code Session.connection()}.
|
||||
* @param ex the SQLException
|
||||
* @return the corresponding DataAccessException instance
|
||||
* @see #setJdbcExceptionTranslator
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.hibernate.Session;
|
||||
/**
|
||||
* Callback interface for Hibernate code. To be used with {@link HibernateTemplate}'s
|
||||
* execution methods, often as anonymous classes within a method implementation.
|
||||
* A typical implementation will call <code>Session.load/find/update</code> to perform
|
||||
* A typical implementation will call {@code Session.load/find/update} to perform
|
||||
* some operations on persistent objects. It can also perform direct JDBC operations
|
||||
* via Hibernate's <code>Session.connection()</code>, operating on a JDBC Connection.
|
||||
* via Hibernate's {@code Session.connection()}, operating on a JDBC Connection.
|
||||
*
|
||||
* <p>Note that Hibernate works on unmodified plain Java objects, performing dirty
|
||||
* detection via copies made at load time. Returned objects can thus be used outside
|
||||
@@ -44,9 +44,9 @@ import org.hibernate.Session;
|
||||
public interface HibernateCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>HibernateTemplate.execute</code> with an active
|
||||
* Hibernate <code>Session</code>. Does not need to care about activating
|
||||
* or closing the <code>Session</code>, or handling transactions.
|
||||
* Gets called by {@code HibernateTemplate.execute} with an active
|
||||
* Hibernate {@code Session}. Does not need to care about activating
|
||||
* or closing the {@code Session}, or handling transactions.
|
||||
*
|
||||
* <p>If called without a thread-bound Hibernate transaction (initiated
|
||||
* by HibernateTransactionManager), the code will simply get executed on the
|
||||
@@ -60,7 +60,7 @@ public interface HibernateCallback<T> {
|
||||
* It gets propagated to the caller of the template.
|
||||
*
|
||||
* @param session active Hibernate session
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws HibernateException if thrown by the Hibernate API
|
||||
* @throws SQLException if thrown by Hibernate-exposed JDBC API
|
||||
* @see HibernateTemplate#execute
|
||||
|
||||
@@ -32,8 +32,8 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* participates in it.
|
||||
*
|
||||
* <p>Application code must retrieve a Hibernate Session via the
|
||||
* <code>SessionFactoryUtils.getSession</code> method or - preferably -
|
||||
* Hibernate's own <code>SessionFactory.getCurrentSession()</code> method, to be
|
||||
* {@code SessionFactoryUtils.getSession} method or - preferably -
|
||||
* Hibernate's own {@code SessionFactory.getCurrentSession()} method, to be
|
||||
* able to detect a thread-bound Session. Typically, the code will look like as follows:
|
||||
*
|
||||
* <pre>
|
||||
@@ -44,9 +44,9 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* }</pre>
|
||||
*
|
||||
* Note that this interceptor automatically translates HibernateExceptions,
|
||||
* via delegating to the <code>SessionFactoryUtils.convertHibernateAccessException</code>
|
||||
* via delegating to the {@code SessionFactoryUtils.convertHibernateAccessException}
|
||||
* method that converts them to exceptions that are compatible with the
|
||||
* <code>org.springframework.dao</code> exception hierarchy (like HibernateTemplate does).
|
||||
* {@code org.springframework.dao} exception hierarchy (like HibernateTemplate does).
|
||||
* This can be turned off if the raw exceptions are preferred.
|
||||
*
|
||||
* <p>This class can be considered a declarative alternative to HibernateTemplate's
|
||||
@@ -76,7 +76,7 @@ public class HibernateInterceptor extends HibernateAccessor implements MethodInt
|
||||
|
||||
/**
|
||||
* Set whether to convert any HibernateException raised to a Spring DataAccessException,
|
||||
* compatible with the <code>org.springframework.dao</code> exception hierarchy.
|
||||
* compatible with the {@code org.springframework.dao} exception hierarchy.
|
||||
* <p>Default is "true". Turn this flag off to let the caller receive raw exceptions
|
||||
* as-is, without any wrapping.
|
||||
* @see org.springframework.dao.DataAccessException
|
||||
|
||||
@@ -33,26 +33,26 @@ import org.springframework.dao.DataAccessException;
|
||||
* implemented by {@link HibernateTemplate}. Not often used, but a useful
|
||||
* option to enhance testability, as it can easily be mocked or stubbed.
|
||||
*
|
||||
* <p>Defines <code>HibernateTemplate</code>'s data access methods that
|
||||
* <p>Defines {@code HibernateTemplate}'s data access methods that
|
||||
* mirror various {@link org.hibernate.Session} methods. Users are
|
||||
* strongly encouraged to read the Hibernate <code>Session</code> javadocs
|
||||
* strongly encouraged to read the Hibernate {@code Session} javadocs
|
||||
* for details on the semantics of those methods.
|
||||
*
|
||||
* <p>Note that operations that return an {@link java.util.Iterator} (i.e.
|
||||
* <code>iterate(..)</code>) are supposed to be used within Spring-driven
|
||||
* {@code iterate(..)}) are supposed to be used within Spring-driven
|
||||
* or JTA-driven transactions (with {@link HibernateTransactionManager},
|
||||
* {@link org.springframework.transaction.jta.JtaTransactionManager},
|
||||
* or EJB CMT). Else, the <code>Iterator</code> won't be able to read
|
||||
* or EJB CMT). Else, the {@code Iterator} won't be able to read
|
||||
* results from its {@link java.sql.ResultSet} anymore, as the underlying
|
||||
* Hibernate <code>Session</code> will already have been closed.
|
||||
* Hibernate {@code Session} will already have been closed.
|
||||
*
|
||||
* <p>Note that lazy loading will just work with an open Hibernate
|
||||
* <code>Session</code>, either within a transaction or within
|
||||
* {@code Session}, either within a transaction or within
|
||||
* {@link org.springframework.orm.hibernate3.support.OpenSessionInViewFilter}/
|
||||
* {@link org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor}.
|
||||
* Furthermore, some operations just make sense within transactions,
|
||||
* for example: <code>contains</code>, <code>evict</code>, <code>lock</code>,
|
||||
* <code>flush</code>, <code>clear</code>.
|
||||
* for example: {@code contains}, {@code evict}, {@code lock},
|
||||
* {@code flush}, {@code clear}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2
|
||||
@@ -75,10 +75,10 @@ public interface HibernateOperations {
|
||||
* <p>Note: Callback code is not supposed to handle transactions itself!
|
||||
* Use an appropriate transaction manager like
|
||||
* {@link HibernateTransactionManager}. Generally, callback code must not
|
||||
* touch any <code>Session</code> lifecycle methods, like close,
|
||||
* touch any {@code Session} lifecycle methods, like close,
|
||||
* disconnect, or reconnect, to let the template do its work.
|
||||
* @param action callback object that specifies the Hibernate action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
* @see HibernateTransactionManager
|
||||
* @see org.hibernate.Session
|
||||
@@ -91,7 +91,7 @@ public interface HibernateOperations {
|
||||
* <p>This is a convenience method for executing Hibernate find calls or
|
||||
* queries within an action.
|
||||
* @param action calback object that specifies the Hibernate action
|
||||
* @return a List result returned by the action, or <code>null</code>
|
||||
* @return a List result returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
*/
|
||||
List executeFind(HibernateCallback<?> action) throws DataAccessException;
|
||||
@@ -103,14 +103,14 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Return the persistent instance of the given entity class
|
||||
* with the given identifier, or <code>null</code> if not found.
|
||||
* with the given identifier, or {@code null} if not found.
|
||||
* <p>This method is a thin wrapper around
|
||||
* {@link org.hibernate.Session#get(Class, java.io.Serializable)} for convenience.
|
||||
* For an explanation of the exact semantics of this method, please do refer to
|
||||
* the Hibernate API documentation in the first instance.
|
||||
* @param entityClass a persistent class
|
||||
* @param id the identifier of the persistent instance
|
||||
* @return the persistent instance, or <code>null</code> if not found
|
||||
* @return the persistent instance, or {@code null} if not found
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
* @see org.hibernate.Session#get(Class, java.io.Serializable)
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Return the persistent instance of the given entity class
|
||||
* with the given identifier, or <code>null</code> if not found.
|
||||
* with the given identifier, or {@code null} if not found.
|
||||
* <p>Obtains the specified lock mode if the instance exists.
|
||||
* <p>This method is a thin wrapper around
|
||||
* {@link org.hibernate.Session#get(Class, java.io.Serializable, LockMode)} for convenience.
|
||||
@@ -127,7 +127,7 @@ public interface HibernateOperations {
|
||||
* @param entityClass a persistent class
|
||||
* @param id the identifier of the persistent instance
|
||||
* @param lockMode the lock mode to obtain
|
||||
* @return the persistent instance, or <code>null</code> if not found
|
||||
* @return the persistent instance, or {@code null} if not found
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
* @see org.hibernate.Session#get(Class, java.io.Serializable, org.hibernate.LockMode)
|
||||
*/
|
||||
@@ -136,14 +136,14 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Return the persistent instance of the given entity class
|
||||
* with the given identifier, or <code>null</code> if not found.
|
||||
* with the given identifier, or {@code null} if not found.
|
||||
* <p>This method is a thin wrapper around
|
||||
* {@link org.hibernate.Session#get(String, java.io.Serializable)} for convenience.
|
||||
* For an explanation of the exact semantics of this method, please do refer to
|
||||
* the Hibernate API documentation in the first instance.
|
||||
* @param entityName the name of the persistent entity
|
||||
* @param id the identifier of the persistent instance
|
||||
* @return the persistent instance, or <code>null</code> if not found
|
||||
* @return the persistent instance, or {@code null} if not found
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
* @see org.hibernate.Session#get(Class, java.io.Serializable)
|
||||
*/
|
||||
@@ -151,7 +151,7 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Return the persistent instance of the given entity class
|
||||
* with the given identifier, or <code>null</code> if not found.
|
||||
* with the given identifier, or {@code null} if not found.
|
||||
* Obtains the specified lock mode if the instance exists.
|
||||
* <p>This method is a thin wrapper around
|
||||
* {@link org.hibernate.Session#get(String, java.io.Serializable, LockMode)} for convenience.
|
||||
@@ -160,7 +160,7 @@ public interface HibernateOperations {
|
||||
* @param entityName the name of the persistent entity
|
||||
* @param id the identifier of the persistent instance
|
||||
* @param lockMode the lock mode to obtain
|
||||
* @return the persistent instance, or <code>null</code> if not found
|
||||
* @return the persistent instance, or {@code null} if not found
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
* @see org.hibernate.Session#get(Class, java.io.Serializable, org.hibernate.LockMode)
|
||||
*/
|
||||
@@ -308,9 +308,9 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Return an enabled Hibernate {@link Filter} for the given filter name.
|
||||
* The returned <code>Filter</code> instance can be used to set filter parameters.
|
||||
* The returned {@code Filter} instance can be used to set filter parameters.
|
||||
* @param filterName the name of the filter
|
||||
* @return the enabled Hibernate <code>Filter</code> (either already
|
||||
* @return the enabled Hibernate {@code Filter} (either already
|
||||
* enabled or enabled on the fly by this operation)
|
||||
* @throws IllegalStateException if we are not running within a
|
||||
* transactional Session (in which case this operation does not make sense)
|
||||
@@ -415,7 +415,7 @@ public interface HibernateOperations {
|
||||
* according to its id (matching the configured "unsaved-value"?).
|
||||
* Associates the instance with the current Hibernate {@link org.hibernate.Session}.
|
||||
* @param entity the persistent instance to save or update
|
||||
* (to be associated with the Hibernate <code>Session</code>)
|
||||
* (to be associated with the Hibernate {@code Session})
|
||||
* @throws DataAccessException in case of Hibernate errors
|
||||
* @see org.hibernate.Session#saveOrUpdate(Object)
|
||||
*/
|
||||
@@ -424,10 +424,10 @@ public interface HibernateOperations {
|
||||
/**
|
||||
* Save or update the given persistent instance,
|
||||
* according to its id (matching the configured "unsaved-value"?).
|
||||
* Associates the instance with the current Hibernate <code>Session</code>.
|
||||
* Associates the instance with the current Hibernate {@code Session}.
|
||||
* @param entityName the name of the persistent entity
|
||||
* @param entity the persistent instance to save or update
|
||||
* (to be associated with the Hibernate <code>Session</code>)
|
||||
* (to be associated with the Hibernate {@code Session})
|
||||
* @throws DataAccessException in case of Hibernate errors
|
||||
* @see org.hibernate.Session#saveOrUpdate(String, Object)
|
||||
*/
|
||||
@@ -436,12 +436,12 @@ public interface HibernateOperations {
|
||||
/**
|
||||
* Save or update all given persistent instances,
|
||||
* according to its id (matching the configured "unsaved-value"?).
|
||||
* Associates the instances with the current Hibernate <code>Session</code>.
|
||||
* Associates the instances with the current Hibernate {@code Session}.
|
||||
* @param entities the persistent instances to save or update
|
||||
* (to be associated with the Hibernate <code>Session</code>)
|
||||
* (to be associated with the Hibernate {@code Session})
|
||||
* @throws DataAccessException in case of Hibernate errors
|
||||
* @deprecated as of Spring 2.5, in favor of individual
|
||||
* <code>saveOrUpdate</code> or <code>merge</code> usage
|
||||
* {@code saveOrUpdate} or {@code merge} usage
|
||||
*/
|
||||
@Deprecated
|
||||
void saveOrUpdateAll(Collection entities) throws DataAccessException;
|
||||
@@ -469,7 +469,7 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Persist the given transient instance. Follows JSR-220 semantics.
|
||||
* <p>Similar to <code>save</code>, associating the given object
|
||||
* <p>Similar to {@code save}, associating the given object
|
||||
* with the current Hibernate {@link org.hibernate.Session}.
|
||||
* @param entity the persistent instance to persist
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
@@ -480,7 +480,7 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Persist the given transient instance. Follows JSR-220 semantics.
|
||||
* <p>Similar to <code>save</code>, associating the given object
|
||||
* <p>Similar to {@code save}, associating the given object
|
||||
* with the current Hibernate {@link org.hibernate.Session}.
|
||||
* @param entityName the name of the persistent entity
|
||||
* @param entity the persistent instance to persist
|
||||
@@ -493,12 +493,12 @@ public interface HibernateOperations {
|
||||
/**
|
||||
* Copy the state of the given object onto the persistent object
|
||||
* with the same identifier. Follows JSR-220 semantics.
|
||||
* <p>Similar to <code>saveOrUpdate</code>, but never associates the given
|
||||
* <p>Similar to {@code saveOrUpdate}, but never associates the given
|
||||
* object with the current Hibernate Session. In case of a new entity,
|
||||
* the state will be copied over as well.
|
||||
* <p>Note that <code>merge</code> will <i>not</i> update the identifiers
|
||||
* <p>Note that {@code merge} will <i>not</i> update the identifiers
|
||||
* in the passed-in object graph (in contrast to TopLink)! Consider
|
||||
* registering Spring's <code>IdTransferringMergeEventListener</code> if
|
||||
* registering Spring's {@code IdTransferringMergeEventListener} if
|
||||
* you would like to have newly assigned ids transferred to the original
|
||||
* object graph too.
|
||||
* @param entity the object to merge with the corresponding persistence instance
|
||||
@@ -513,12 +513,12 @@ public interface HibernateOperations {
|
||||
/**
|
||||
* Copy the state of the given object onto the persistent object
|
||||
* with the same identifier. Follows JSR-220 semantics.
|
||||
* <p>Similar to <code>saveOrUpdate</code>, but never associates the given
|
||||
* <p>Similar to {@code saveOrUpdate}, but never associates the given
|
||||
* object with the current Hibernate {@link org.hibernate.Session}. In
|
||||
* the case of a new entity, the state will be copied over as well.
|
||||
* <p>Note that <code>merge</code> will <i>not</i> update the identifiers
|
||||
* <p>Note that {@code merge} will <i>not</i> update the identifiers
|
||||
* in the passed-in object graph (in contrast to TopLink)! Consider
|
||||
* registering Spring's <code>IdTransferringMergeEventListener</code>
|
||||
* registering Spring's {@code IdTransferringMergeEventListener}
|
||||
* if you would like to have newly assigned ids transferred to the
|
||||
* original object graph too.
|
||||
* @param entityName the name of the persistent entity
|
||||
@@ -891,10 +891,10 @@ public interface HibernateOperations {
|
||||
|
||||
/**
|
||||
* Immediately close an {@link Iterator} created by any of the various
|
||||
* <code>iterate(..)</code> operations, instead of waiting until the
|
||||
* {@code iterate(..)} operations, instead of waiting until the
|
||||
* session is closed or disconnected.
|
||||
* @param it the <code>Iterator</code> to close
|
||||
* @throws DataAccessException if the <code>Iterator</code> could not be closed
|
||||
* @param it the {@code Iterator} to close
|
||||
* @throws DataAccessException if the {@code Iterator} could not be closed
|
||||
* @see org.hibernate.Hibernate#close
|
||||
*/
|
||||
void closeIterator(Iterator it) throws DataAccessException;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.dao.UncategorizedDataAccessException;
|
||||
/**
|
||||
* Hibernate-specific subclass of UncategorizedDataAccessException,
|
||||
* for Hibernate system errors that do not match any concrete
|
||||
* <code>org.springframework.dao</code> exceptions.
|
||||
* {@code org.springframework.dao} exceptions.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2
|
||||
|
||||
@@ -49,9 +49,9 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Helper class that simplifies Hibernate data access code. Automatically
|
||||
* converts HibernateExceptions into DataAccessExceptions, following the
|
||||
* <code>org.springframework.dao</code> exception hierarchy.
|
||||
* {@code org.springframework.dao} exception hierarchy.
|
||||
*
|
||||
* <p>The central method is <code>execute</code>, supporting Hibernate access code
|
||||
* <p>The central method is {@code execute}, supporting Hibernate access code
|
||||
* implementing the {@link HibernateCallback} interface. It provides Hibernate Session
|
||||
* handling such that neither the HibernateCallback implementation nor the calling
|
||||
* code needs to explicitly care about retrieving/closing Hibernate Sessions,
|
||||
@@ -70,7 +70,7 @@ import org.springframework.util.Assert;
|
||||
* instead, based on {@link org.hibernate.SessionFactory#getCurrentSession()}.</b>
|
||||
*
|
||||
* <p>This class can be considered as direct alternative to working with the raw
|
||||
* Hibernate3 Session API (through <code>SessionFactory.getCurrentSession()</code>).
|
||||
* Hibernate3 Session API (through {@code SessionFactory.getCurrentSession()}).
|
||||
* The major advantage is its automatic conversion to DataAccessExceptions as well
|
||||
* as its capability to fall back to 'auto-commit' style behavior when used outside
|
||||
* of transactions. <b>Note that HibernateTemplate will perform its own Session
|
||||
@@ -82,7 +82,7 @@ import org.springframework.util.Assert;
|
||||
* The Spring application context will manage its lifecycle, initializing and
|
||||
* shutting down the factory as part of the application.
|
||||
*
|
||||
* <p>Note that operations that return an Iterator (i.e. <code>iterate</code>)
|
||||
* <p>Note that operations that return an Iterator (i.e. {@code iterate})
|
||||
* are supposed to be used within Spring-driven or JTA-driven transactions
|
||||
* (with HibernateTransactionManager, JtaTransactionManager, or EJB CMT).
|
||||
* Else, the Iterator won't be able to read results from its ResultSet anymore,
|
||||
@@ -91,8 +91,8 @@ import org.springframework.util.Assert;
|
||||
* <p>Lazy loading will also just work with an open Hibernate Session,
|
||||
* either within a transaction or within OpenSessionInViewFilter/Interceptor.
|
||||
* Furthermore, some operations just make sense within transactions,
|
||||
* for example: <code>contains</code>, <code>evict</code>, <code>lock</code>,
|
||||
* <code>flush</code>, <code>clear</code>.
|
||||
* for example: {@code contains}, {@code evict}, {@code lock},
|
||||
* {@code flush}, {@code clear}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.2
|
||||
@@ -154,22 +154,22 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
|
||||
/**
|
||||
* Set if a new {@link Session} should be created when no transactional
|
||||
* <code>Session</code> can be found for the current thread.
|
||||
* The default value is <code>true</code>.
|
||||
* <p><code>HibernateTemplate</code> is aware of a corresponding
|
||||
* <code>Session</code> bound to the current thread, for example when using
|
||||
* {@link HibernateTransactionManager}. If <code>allowCreate</code> is
|
||||
* <code>true</code>, a new non-transactional <code>Session</code> will be
|
||||
* {@code Session} can be found for the current thread.
|
||||
* The default value is {@code true}.
|
||||
* <p>{@code HibernateTemplate} is aware of a corresponding
|
||||
* {@code Session} bound to the current thread, for example when using
|
||||
* {@link HibernateTransactionManager}. If {@code allowCreate} is
|
||||
* {@code true}, a new non-transactional {@code Session} will be
|
||||
* created if none is found, which needs to be closed at the end of the operation.
|
||||
* If <code>false</code>, an {@link IllegalStateException} will get thrown in
|
||||
* If {@code false}, an {@link IllegalStateException} will get thrown in
|
||||
* this case.
|
||||
* <p><b>NOTE: As of Spring 2.5, switching <code>allowCreate</code>
|
||||
* to <code>false</code> will delegate to Hibernate's
|
||||
* <p><b>NOTE: As of Spring 2.5, switching {@code allowCreate}
|
||||
* to {@code false} will delegate to Hibernate's
|
||||
* {@link org.hibernate.SessionFactory#getCurrentSession()} method,</b>
|
||||
* which - with Spring-based setup - will by default delegate to Spring's
|
||||
* <code>SessionFactoryUtils.getSession(sessionFactory, false)</code>.
|
||||
* {@code SessionFactoryUtils.getSession(sessionFactory, false)}.
|
||||
* This mode also allows for custom Hibernate CurrentSessionContext strategies
|
||||
* to be plugged in, whereas <code>allowCreate</code> set to <code>true</code>
|
||||
* to be plugged in, whereas {@code allowCreate} set to {@code true}
|
||||
* will always use a Spring-managed Hibernate Session.
|
||||
* @see SessionFactoryUtils#getSession(SessionFactory, boolean)
|
||||
*/
|
||||
@@ -211,7 +211,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
* Set whether to expose the native Hibernate Session to
|
||||
* HibernateCallback code.
|
||||
* <p>Default is "false": a Session proxy will be returned, suppressing
|
||||
* <code>close</code> calls and automatically applying query cache
|
||||
* {@code close} calls and automatically applying query cache
|
||||
* settings and transaction timeouts.
|
||||
* @see HibernateCallback
|
||||
* @see org.hibernate.Session
|
||||
@@ -354,7 +354,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
* <p>This execute variant overrides the template-wide
|
||||
* {@link #isAlwaysUseNewSession() "alwaysUseNewSession"} setting.
|
||||
* @param action callback object that specifies the Hibernate action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
*/
|
||||
public <T> T executeWithNewSession(HibernateCallback<T> action) {
|
||||
@@ -367,7 +367,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
* <p>This execute variant overrides the template-wide
|
||||
* {@link #isExposeNativeSession() "exposeNativeSession"} setting.
|
||||
* @param action callback object that specifies the Hibernate action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
*/
|
||||
public <T> T executeWithNativeSession(HibernateCallback<T> action) {
|
||||
@@ -381,7 +381,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
* even if there is a pre-bound transactional Session
|
||||
* @param enforceNativeSession whether to enforce exposure of the native
|
||||
* Hibernate Session to callback code
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
*/
|
||||
protected <T> T doExecute(HibernateCallback<T> action, boolean enforceNewSession, boolean enforceNativeSession)
|
||||
@@ -443,7 +443,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
* JDBC Connection as a transactional Session, if applicable), a pre-bound
|
||||
* Session in case of "allowCreate" turned off, and a pre-bound or new Session
|
||||
* otherwise (new only if no transactional or otherwise pre-bound Session exists).
|
||||
* @return the Session to use (never <code>null</code>)
|
||||
* @return the Session to use (never {@code null})
|
||||
* @see SessionFactoryUtils#getSession
|
||||
* @see SessionFactoryUtils#getNewSession
|
||||
* @see #setAlwaysUseNewSession
|
||||
@@ -1160,7 +1160,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
/**
|
||||
* Check whether write operations are allowed on the given Session.
|
||||
* <p>Default implementation throws an InvalidDataAccessApiUsageException in
|
||||
* case of <code>FlushMode.MANUAL</code>. Can be overridden in subclasses.
|
||||
* case of {@code FlushMode.MANUAL}. Can be overridden in subclasses.
|
||||
* @param session current Hibernate Session
|
||||
* @throws InvalidDataAccessApiUsageException if write operations are not allowed
|
||||
* @see #setCheckWriteOperations
|
||||
|
||||
@@ -59,7 +59,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* allowing for one thread-bound Session per factory. {@link SessionFactoryUtils}
|
||||
* and {@link HibernateTemplate} are aware of thread-bound Sessions and participate
|
||||
* in such transactions automatically. Using either of those or going through
|
||||
* <code>SessionFactory.getCurrentSession()</code> is required for Hibernate
|
||||
* {@code SessionFactory.getCurrentSession()} is required for Hibernate
|
||||
* access code that needs to support this transaction handling mechanism.
|
||||
*
|
||||
* <p>Supports custom isolation levels, and timeouts that get applied as
|
||||
@@ -234,7 +234,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
|
||||
/**
|
||||
* Set whether to autodetect a JDBC DataSource used by the Hibernate SessionFactory,
|
||||
* if set via LocalSessionFactoryBean's <code>setDataSource</code>. Default is "true".
|
||||
* if set via LocalSessionFactoryBean's {@code setDataSource}. Default is "true".
|
||||
* <p>Can be turned off to deliberately ignore an available DataSource, in order
|
||||
* to not expose Hibernate transactions as JDBC transactions for that DataSource.
|
||||
* @see #setDataSource
|
||||
@@ -251,7 +251,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
* JDBC Connection.
|
||||
* <p>Default is "true". If you turn this flag off, the transaction manager
|
||||
* will not support per-transaction isolation levels anymore. It will not
|
||||
* call <code>Connection.setReadOnly(true)</code> for read-only transactions
|
||||
* call {@code Connection.setReadOnly(true)} for read-only transactions
|
||||
* anymore either. If this flag is turned off, no cleanup of a JDBC Connection
|
||||
* is required after a transaction, since no Connection settings will get modified.
|
||||
* @see java.sql.Connection#setTransactionIsolation
|
||||
@@ -274,14 +274,14 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
* <p>Switch this flag to "true" in order to enforce use of a Hibernate-managed Session.
|
||||
* Note that this requires {@link org.hibernate.SessionFactory#getCurrentSession()}
|
||||
* to always return a proper Session when called for a Spring-managed transaction;
|
||||
* transaction begin will fail if the <code>getCurrentSession()</code> call fails.
|
||||
* transaction begin will fail if the {@code getCurrentSession()} call fails.
|
||||
* <p>This mode will typically be used in combination with a custom Hibernate
|
||||
* {@link org.hibernate.context.CurrentSessionContext} implementation that stores
|
||||
* Sessions in a place other than Spring's TransactionSynchronizationManager.
|
||||
* It may also be used in combination with Spring's Open-Session-in-View support
|
||||
* (using Spring's default {@link SpringSessionContext}), in which case it subtly
|
||||
* differs from the Spring-managed Session mode: The pre-bound Session will <i>not</i>
|
||||
* receive a <code>clear()</code> call (on rollback) or a <code>disconnect()</code>
|
||||
* receive a {@code clear()} call (on rollback) or a {@code disconnect()}
|
||||
* call (on transaction completion) in such a scenario; this is rather left up
|
||||
* to a custom CurrentSessionContext implementation (if desired).
|
||||
*/
|
||||
@@ -295,7 +295,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
* commit step. Switch this to "true" in order to enforce an explicit early
|
||||
* flush right <i>before</i> the actual commit step.
|
||||
* <p>An early flush happens before the before-commit synchronization phase,
|
||||
* making flushed state visible to <code>beforeCommit</code> callbacks of registered
|
||||
* making flushed state visible to {@code beforeCommit} callbacks of registered
|
||||
* {@link org.springframework.transaction.support.TransactionSynchronization}
|
||||
* objects. Such explicit flush behavior is consistent with Spring-driven
|
||||
* flushing in a JTA transaction environment, so may also get enforced for
|
||||
@@ -342,7 +342,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current Hibernate entity interceptor, or <code>null</code> if none.
|
||||
* Return the current Hibernate entity interceptor, or {@code null} if none.
|
||||
* Resolves an entity interceptor bean name via the bean factory,
|
||||
* if necessary.
|
||||
* @throws IllegalStateException if bean name specified but no bean factory set
|
||||
@@ -758,7 +758,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
* <p>Default implementation checks the Session's connection release mode
|
||||
* to be "on_close". Unfortunately, this requires casting to SessionImpl,
|
||||
* as of Hibernate 3.1. If that cast doesn't work, we'll simply assume
|
||||
* we're safe and return <code>true</code>.
|
||||
* we're safe and return {@code true}.
|
||||
* @param session the Hibernate Session to check
|
||||
* @see org.hibernate.impl.SessionImpl#getConnectionReleaseMode()
|
||||
* @see org.hibernate.ConnectionReleaseMode#ON_CLOSE
|
||||
@@ -775,7 +775,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
|
||||
/**
|
||||
* Convert the given HibernateException to an appropriate exception
|
||||
* from the <code>org.springframework.dao</code> hierarchy.
|
||||
* from the {@code org.springframework.dao} hierarchy.
|
||||
* <p>Will automatically apply a specified SQLExceptionTranslator to a
|
||||
* Hibernate JDBCException, else rely on Hibernate's default translation.
|
||||
* @param ex HibernateException that occured
|
||||
@@ -795,7 +795,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
|
||||
/**
|
||||
* Convert the given Hibernate JDBCException to an appropriate exception
|
||||
* from the <code>org.springframework.dao</code> hierarchy, using the
|
||||
* from the {@code org.springframework.dao} hierarchy, using the
|
||||
* given SQLExceptionTranslator.
|
||||
* @param ex Hibernate JDBCException that occured
|
||||
* @param translator the SQLExceptionTranslator to use
|
||||
@@ -899,7 +899,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
|
||||
/**
|
||||
* Holder for suspended resources.
|
||||
* Used internally by <code>doSuspend</code> and <code>doResume</code>.
|
||||
* Used internally by {@code doSuspend} and {@code doResume}.
|
||||
*/
|
||||
private static class SuspendedResourcesHolder {
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation returns <code>false</code>: We cannot guarantee
|
||||
* This implementation returns {@code false}: We cannot guarantee
|
||||
* to receive the same Connection within a transaction, not even when
|
||||
* dealing with a JNDI DataSource.
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@ package org.springframework.orm.hibernate3;
|
||||
public class LocalJtaDataSourceConnectionProvider extends LocalDataSourceConnectionProvider {
|
||||
|
||||
/**
|
||||
* This implementation returns <code>true</code>,
|
||||
* This implementation returns {@code true},
|
||||
* since we're assuming a JTA DataSource.
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -79,11 +79,11 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* <p>This factory bean will by default expose a transaction-aware SessionFactory
|
||||
* proxy, letting data access code work with the plain Hibernate SessionFactory
|
||||
* and its <code>getCurrentSession()</code> method, while still being able to
|
||||
* and its {@code getCurrentSession()} method, while still being able to
|
||||
* participate in current Spring-managed transactions: with any transaction
|
||||
* management strategy, either local or JTA / EJB CMT, and any transaction
|
||||
* synchronization mechanism, either Spring or JTA. Furthermore,
|
||||
* <code>getCurrentSession()</code> will also seamlessly work with
|
||||
* {@code getCurrentSession()} will also seamlessly work with
|
||||
* a request-scoped Session managed by
|
||||
* {@link org.springframework.orm.hibernate3.support.OpenSessionInViewFilter} /
|
||||
* {@link org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor}.
|
||||
@@ -384,7 +384,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* <p>As of Hibernate 3.3, this is the preferred mechanism for configuring
|
||||
* caches, superseding the {@link #setCacheProvider CacheProvider SPI}.
|
||||
* For Hibernate 3.2 compatibility purposes, the accepted reference is of type
|
||||
* Object: the actual type is <code>org.hibernate.cache.RegionFactory</code>.
|
||||
* Object: the actual type is {@code org.hibernate.cache.RegionFactory}.
|
||||
* <p>Note: If this is set, the Hibernate settings should not define a
|
||||
* cache provider to avoid meaningless double configuration.
|
||||
* @see org.hibernate.cache.RegionFactory
|
||||
@@ -825,7 +825,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* To be implemented by subclasses that want to to register further mappings
|
||||
* on the Configuration object after this FactoryBean registered its specified
|
||||
* mappings.
|
||||
* <p>Invoked <i>before</i> the <code>Configuration.buildMappings()</code> call,
|
||||
* <p>Invoked <i>before</i> the {@code Configuration.buildMappings()} call,
|
||||
* so that it can still extend and modify the mapping information.
|
||||
* @param config the current Configuration object
|
||||
* @throws HibernateException in case of Hibernate initialization errors
|
||||
@@ -838,7 +838,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* To be implemented by subclasses that want to to perform custom
|
||||
* post-processing of the Configuration object after this FactoryBean
|
||||
* performed its default initialization.
|
||||
* <p>Invoked <i>after</i> the <code>Configuration.buildMappings()</code> call,
|
||||
* <p>Invoked <i>after</i> the {@code Configuration.buildMappings()} call,
|
||||
* so that it can operate on the completed and fully parsed mapping information.
|
||||
* @param config the current Configuration object
|
||||
* @throws HibernateException in case of Hibernate initialization errors
|
||||
@@ -917,7 +917,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* on application startup. Can also be invoked manually.
|
||||
* <p>Fetch the LocalSessionFactoryBean itself rather than the exposed
|
||||
* SessionFactory to be able to invoke this method, e.g. via
|
||||
* <code>LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");</code>.
|
||||
* {@code LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");}.
|
||||
* <p>Uses the SessionFactory that this bean generates for accessing a
|
||||
* JDBC connection to perform the script.
|
||||
* @throws DataAccessException in case of script execution errors
|
||||
@@ -963,7 +963,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* SchemaValidator class, to be invoked after application startup.
|
||||
* <p>Fetch the LocalSessionFactoryBean itself rather than the exposed
|
||||
* SessionFactory to be able to invoke this method, e.g. via
|
||||
* <code>LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");</code>.
|
||||
* {@code LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");}.
|
||||
* <p>Uses the SessionFactory that this bean generates for accessing a
|
||||
* JDBC connection to perform the script.
|
||||
* @throws DataAccessException in case of script execution errors
|
||||
@@ -1007,7 +1007,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* SchemaExport class, to be invoked on application setup.
|
||||
* <p>Fetch the LocalSessionFactoryBean itself rather than the exposed
|
||||
* SessionFactory to be able to invoke this method, e.g. via
|
||||
* <code>LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");</code>.
|
||||
* {@code LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");}.
|
||||
* <p>Uses the SessionFactory that this bean generates for accessing a
|
||||
* JDBC connection to perform the script.
|
||||
* @throws org.springframework.dao.DataAccessException in case of script execution errors
|
||||
@@ -1038,7 +1038,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* SchemaExport class, to be invoked on application setup.
|
||||
* <p>Fetch the LocalSessionFactoryBean itself rather than the exposed
|
||||
* SessionFactory to be able to invoke this method, e.g. via
|
||||
* <code>LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");</code>.
|
||||
* {@code LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) ctx.getBean("&mySessionFactory");}.
|
||||
* <p>Uses the SessionFactory that this bean generates for accessing a
|
||||
* JDBC connection to perform the script.
|
||||
* @throws DataAccessException in case of script execution errors
|
||||
@@ -1078,7 +1078,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
/**
|
||||
* Execute the given schema script on the given JDBC Connection.
|
||||
* <p>Note that the default implementation will log unsuccessful statements
|
||||
* and continue to execute. Override the <code>executeSchemaStatement</code>
|
||||
* and continue to execute. Override the {@code executeSchemaStatement}
|
||||
* method to treat failures differently.
|
||||
* @param con the JDBC Connection to execute the script on
|
||||
* @param sql the SQL statements to execute
|
||||
|
||||
@@ -99,7 +99,7 @@ public abstract class SessionFactoryUtils {
|
||||
|
||||
/**
|
||||
* Order value for TransactionSynchronization objects that clean up Hibernate Sessions.
|
||||
* Returns <code>DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER - 100</code>
|
||||
* Returns {@code DataSourceUtils.CONNECTION_SYNCHRONIZATION_ORDER - 100}
|
||||
* to execute Session cleanup before JDBC Connection cleanup, if any.
|
||||
* @see org.springframework.jdbc.datasource.DataSourceUtils#CONNECTION_SYNCHRONIZATION_ORDER
|
||||
*/
|
||||
@@ -115,7 +115,7 @@ public abstract class SessionFactoryUtils {
|
||||
/**
|
||||
* Determine the DataSource of the given SessionFactory.
|
||||
* @param sessionFactory the SessionFactory to check
|
||||
* @return the DataSource, or <code>null</code> if none found
|
||||
* @return the DataSource, or {@code null} if none found
|
||||
* @see org.hibernate.engine.SessionFactoryImplementor#getConnectionProvider
|
||||
* @see LocalDataSourceConnectionProvider
|
||||
*/
|
||||
@@ -153,7 +153,7 @@ public abstract class SessionFactoryUtils {
|
||||
* SessionFactoryImplementor (the usual case), falling back to the
|
||||
* SessionFactory reference that the Session itself carries.
|
||||
* @param sessionFactory Hibernate SessionFactory
|
||||
* @param session Hibernate Session (can also be <code>null</code>)
|
||||
* @param session Hibernate Session (can also be {@code null})
|
||||
* @return the JTA TransactionManager, if any
|
||||
* @see javax.transaction.TransactionManager
|
||||
* @see SessionFactoryImplementor#getTransactionManager
|
||||
@@ -179,9 +179,9 @@ public abstract class SessionFactoryUtils {
|
||||
* Get a Hibernate Session for the given SessionFactory. Is aware of and will
|
||||
* return any existing corresponding Session bound to the current thread, for
|
||||
* example when using {@link HibernateTransactionManager}. Will create a new
|
||||
* Session otherwise, if "allowCreate" is <code>true</code>.
|
||||
* <p>This is the <code>getSession</code> method used by typical data access code,
|
||||
* in combination with <code>releaseSession</code> called when done with
|
||||
* Session otherwise, if "allowCreate" is {@code true}.
|
||||
* <p>This is the {@code getSession} method used by typical data access code,
|
||||
* in combination with {@code releaseSession} called when done with
|
||||
* the Session. Note that HibernateTemplate allows to write data access code
|
||||
* without caring about such resource handling.
|
||||
* @param sessionFactory Hibernate SessionFactory to create the session with
|
||||
@@ -190,7 +190,7 @@ public abstract class SessionFactoryUtils {
|
||||
* @return the Hibernate Session
|
||||
* @throws DataAccessResourceFailureException if the Session couldn't be created
|
||||
* @throws IllegalStateException if no thread-bound Session found and
|
||||
* "allowCreate" is <code>false</code>
|
||||
* "allowCreate" is {@code false}
|
||||
* @see #getSession(SessionFactory, Interceptor, SQLExceptionTranslator)
|
||||
* @see #releaseSession
|
||||
* @see HibernateTemplate
|
||||
@@ -217,9 +217,9 @@ public abstract class SessionFactoryUtils {
|
||||
* (i.e. on LocalSessionFactoryBean), on HibernateTransactionManager, or on
|
||||
* HibernateInterceptor/HibernateTemplate.
|
||||
* @param sessionFactory Hibernate SessionFactory to create the session with
|
||||
* @param entityInterceptor Hibernate entity interceptor, or <code>null</code> if none
|
||||
* @param entityInterceptor Hibernate entity interceptor, or {@code null} if none
|
||||
* @param jdbcExceptionTranslator SQLExcepionTranslator to use for flushing the
|
||||
* Session on transaction synchronization (may be <code>null</code>; only used
|
||||
* Session on transaction synchronization (may be {@code null}; only used
|
||||
* when actually registering a transaction synchronization)
|
||||
* @return the Hibernate Session
|
||||
* @throws DataAccessResourceFailureException if the Session couldn't be created
|
||||
@@ -243,7 +243,7 @@ public abstract class SessionFactoryUtils {
|
||||
* Get a Hibernate Session for the given SessionFactory. Is aware of and will
|
||||
* return any existing corresponding Session bound to the current thread, for
|
||||
* example when using {@link HibernateTransactionManager}. Will create a new
|
||||
* Session otherwise, if "allowCreate" is <code>true</code>.
|
||||
* Session otherwise, if "allowCreate" is {@code true}.
|
||||
* <p>Throws the original HibernateException, in contrast to {@link #getSession}.
|
||||
* @param sessionFactory Hibernate SessionFactory to create the session with
|
||||
* @param allowCreate whether a non-transactional Session should be created
|
||||
@@ -262,18 +262,18 @@ public abstract class SessionFactoryUtils {
|
||||
* Get a Hibernate Session for the given SessionFactory. Is aware of and will
|
||||
* return any existing corresponding Session bound to the current thread, for
|
||||
* example when using {@link HibernateTransactionManager}. Will create a new
|
||||
* Session otherwise, if "allowCreate" is <code>true</code>.
|
||||
* Session otherwise, if "allowCreate" is {@code true}.
|
||||
* <p>Same as {@link #getSession}, but throwing the original HibernateException.
|
||||
* @param sessionFactory Hibernate SessionFactory to create the session with
|
||||
* @param entityInterceptor Hibernate entity interceptor, or <code>null</code> if none
|
||||
* @param entityInterceptor Hibernate entity interceptor, or {@code null} if none
|
||||
* @param jdbcExceptionTranslator SQLExcepionTranslator to use for flushing the
|
||||
* Session on transaction synchronization (may be <code>null</code>)
|
||||
* Session on transaction synchronization (may be {@code null})
|
||||
* @param allowCreate whether a non-transactional Session should be created
|
||||
* when no transactional Session can be found for the current thread
|
||||
* @return the Hibernate Session
|
||||
* @throws HibernateException if the Session couldn't be created
|
||||
* @throws IllegalStateException if no thread-bound Session found and
|
||||
* "allowCreate" is <code>false</code>
|
||||
* "allowCreate" is {@code false}
|
||||
*/
|
||||
private static Session doGetSession(
|
||||
SessionFactory sessionFactory, Interceptor entityInterceptor,
|
||||
@@ -366,7 +366,7 @@ public abstract class SessionFactoryUtils {
|
||||
* @param sessionHolder the SessionHolder to check
|
||||
* @param sessionFactory the SessionFactory to get the JTA TransactionManager from
|
||||
* @param jdbcExceptionTranslator SQLExcepionTranslator to use for flushing the
|
||||
* Session on transaction synchronization (may be <code>null</code>)
|
||||
* Session on transaction synchronization (may be {@code null})
|
||||
* @return the associated Session, if any
|
||||
* @throws DataAccessResourceFailureException if the Session couldn't be created
|
||||
*/
|
||||
@@ -438,7 +438,7 @@ public abstract class SessionFactoryUtils {
|
||||
* @param session the Session to register
|
||||
* @param sessionFactory the SessionFactory that the Session was created with
|
||||
* @param jdbcExceptionTranslator SQLExcepionTranslator to use for flushing the
|
||||
* Session on transaction synchronization (may be <code>null</code>)
|
||||
* Session on transaction synchronization (may be {@code null})
|
||||
*/
|
||||
private static void registerJtaSynchronization(Session session, SessionFactory sessionFactory,
|
||||
SQLExceptionTranslator jdbcExceptionTranslator, SessionHolder sessionHolder) {
|
||||
@@ -504,7 +504,7 @@ public abstract class SessionFactoryUtils {
|
||||
* that shares the transaction's JDBC Connection. More specifically,
|
||||
* it will use the same JDBC Connection as the pre-bound Hibernate Session.
|
||||
* @param sessionFactory Hibernate SessionFactory to create the session with
|
||||
* @param entityInterceptor Hibernate entity interceptor, or <code>null</code> if none
|
||||
* @param entityInterceptor Hibernate entity interceptor, or {@code null} if none
|
||||
* @return the new Session
|
||||
*/
|
||||
public static Session getNewSession(SessionFactory sessionFactory, Interceptor entityInterceptor) {
|
||||
@@ -537,10 +537,10 @@ public abstract class SessionFactoryUtils {
|
||||
|
||||
/**
|
||||
* Stringify the given Session for debug logging.
|
||||
* Returns output equivalent to <code>Object.toString()</code>:
|
||||
* Returns output equivalent to {@code Object.toString()}:
|
||||
* the fully qualified class name + "@" + the identity hash code.
|
||||
* <p>The sole reason why this is necessary is because Hibernate3's
|
||||
* <code>Session.toString()</code> implementation is broken (and won't be fixed):
|
||||
* {@code Session.toString()} implementation is broken (and won't be fixed):
|
||||
* it logs the toString representation of all persistent objects in the Session,
|
||||
* which might lead to ConcurrentModificationExceptions if the persistent objects
|
||||
* in turn refer to the Session (for example, for lazy loading).
|
||||
@@ -554,7 +554,7 @@ public abstract class SessionFactoryUtils {
|
||||
/**
|
||||
* Return whether there is a transactional Hibernate Session for the current thread,
|
||||
* that is, a Session bound to the current thread by Spring's transaction facilities.
|
||||
* @param sessionFactory Hibernate SessionFactory to check (may be <code>null</code>)
|
||||
* @param sessionFactory Hibernate SessionFactory to check (may be {@code null})
|
||||
* @return whether there is a transactional Session for current thread
|
||||
*/
|
||||
public static boolean hasTransactionalSession(SessionFactory sessionFactory) {
|
||||
@@ -571,7 +571,7 @@ public abstract class SessionFactoryUtils {
|
||||
* bound to the current thread by Spring's transaction facilities.
|
||||
* @param session the Hibernate Session to check
|
||||
* @param sessionFactory Hibernate SessionFactory that the Session was created with
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @return whether the Session is transactional
|
||||
*/
|
||||
public static boolean isSessionTransactional(Session session, SessionFactory sessionFactory) {
|
||||
@@ -588,7 +588,7 @@ public abstract class SessionFactoryUtils {
|
||||
* Hibernate Query object.
|
||||
* @param query the Hibernate Query object
|
||||
* @param sessionFactory Hibernate SessionFactory that the Query was created for
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @see org.hibernate.Query#setTimeout
|
||||
*/
|
||||
public static void applyTransactionTimeout(Query query, SessionFactory sessionFactory) {
|
||||
@@ -620,7 +620,7 @@ public abstract class SessionFactoryUtils {
|
||||
|
||||
/**
|
||||
* Convert the given HibernateException to an appropriate exception
|
||||
* from the <code>org.springframework.dao</code> hierarchy.
|
||||
* from the {@code org.springframework.dao} hierarchy.
|
||||
* @param ex HibernateException that occured
|
||||
* @return the corresponding DataAccessException instance
|
||||
* @see HibernateAccessor#convertHibernateAccessException
|
||||
@@ -753,9 +753,9 @@ public abstract class SessionFactoryUtils {
|
||||
/**
|
||||
* Close the given Session, created via the given factory,
|
||||
* if it is not managed externally (i.e. not bound to the thread).
|
||||
* @param session the Hibernate Session to close (may be <code>null</code>)
|
||||
* @param session the Hibernate Session to close (may be {@code null})
|
||||
* @param sessionFactory Hibernate SessionFactory that the Session was created with
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
*/
|
||||
public static void releaseSession(Session session, SessionFactory sessionFactory) {
|
||||
if (session == null) {
|
||||
@@ -771,7 +771,7 @@ public abstract class SessionFactoryUtils {
|
||||
* Close the given Session or register it for deferred close.
|
||||
* @param session the Hibernate Session to close
|
||||
* @param sessionFactory Hibernate SessionFactory that the Session was created with
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @see #initDeferredClose
|
||||
* @see #processDeferredClose
|
||||
*/
|
||||
@@ -792,7 +792,7 @@ public abstract class SessionFactoryUtils {
|
||||
/**
|
||||
* Perform actual closing of the Hibernate Session,
|
||||
* catching and logging any cleanup exceptions thrown.
|
||||
* @param session the Hibernate Session to close (may be <code>null</code>)
|
||||
* @param session the Hibernate Session to close (may be {@code null})
|
||||
* @see org.hibernate.Session#close()
|
||||
*/
|
||||
public static void closeSession(Session session) {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TransactionAwareDataSourceConnectionProvider extends LocalDataSourc
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation returns <code>true</code>: We can guarantee
|
||||
* This implementation returns {@code true}: We can guarantee
|
||||
* to receive the same Connection within a transaction, as we are
|
||||
* exposing a TransactionAwareDataSourceProxy.
|
||||
*/
|
||||
|
||||
@@ -141,9 +141,9 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
/**
|
||||
* Specify custom type filters for Spring-based scanning for entity classes.
|
||||
* <p>Default is to search all specified packages for classes annotated with
|
||||
* <code>@javax.persistence.Entity</code>, <code>@javax.persistence.Embeddable</code>
|
||||
* or <code>@javax.persistence.MappedSuperclass</code>, as well as for
|
||||
* Hibernate's special <code>@org.hibernate.annotations.Entity</code>.
|
||||
* {@code @javax.persistence.Entity}, {@code @javax.persistence.Embeddable}
|
||||
* or {@code @javax.persistence.MappedSuperclass}, as well as for
|
||||
* Hibernate's special {@code @org.hibernate.annotations.Entity}.
|
||||
* @see #setPackagesToScan
|
||||
*/
|
||||
public void setEntityTypeFilters(TypeFilter[] entityTypeFilters) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Package providing integration of
|
||||
@@ -10,7 +9,7 @@
|
||||
* for local Hibernate transactions.
|
||||
*
|
||||
* <p><b>This package supports Hibernate 3.x only.</b>
|
||||
* See the <code>org.springframework.orm.hibernate4</code> package for Hibernate 4.x support.
|
||||
* See the {@code org.springframework.orm.hibernate4} package for Hibernate 4.x support.
|
||||
*
|
||||
*/
|
||||
package org.springframework.orm.hibernate3;
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class AbstractLobType implements UserType {
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler
|
||||
* and an explicit JTA TransactionManager (can be <code>null</code>).
|
||||
* and an explicit JTA TransactionManager (can be {@code null}).
|
||||
*/
|
||||
protected AbstractLobType(LobHandler lobHandler, TransactionManager jtaTransactionManager) {
|
||||
this.lobHandler = lobHandler;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class BlobByteArrayType extends AbstractLobType {
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler
|
||||
* and an explicit JTA TransactionManager (can be <code>null</code>).
|
||||
* and an explicit JTA TransactionManager (can be {@code null}).
|
||||
*/
|
||||
protected BlobByteArrayType(LobHandler lobHandler, TransactionManager jtaTransactionManager) {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BlobSerializableType extends AbstractLobType {
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler
|
||||
* and an explicit JTA TransactionManager (can be <code>null</code>).
|
||||
* and an explicit JTA TransactionManager (can be {@code null}).
|
||||
*/
|
||||
protected BlobSerializableType(LobHandler lobHandler, TransactionManager jtaTransactionManager) {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.jdbc.support.lob.LobHandler;
|
||||
* <p>This is intended for the (arguably unnatural, but still common) case
|
||||
* where character data is stored in a binary LOB. This requires encoding
|
||||
* and decoding the characters within this UserType; see the javadoc of the
|
||||
* <code>getCharacterEncoding()</code> method.
|
||||
* {@code getCharacterEncoding()} method.
|
||||
*
|
||||
* <p>Can also be defined in generic Hibernate mappings, as DefaultLobCreator will
|
||||
* work with most JDBC-compliant database drivers. In this case, the field type
|
||||
@@ -60,7 +60,7 @@ public class BlobStringType extends AbstractLobType {
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler
|
||||
* and an explicit JTA TransactionManager (can be <code>null</code>).
|
||||
* and an explicit JTA TransactionManager (can be {@code null}).
|
||||
*/
|
||||
protected BlobStringType(LobHandler lobHandler, TransactionManager jtaTransactionManager) {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
@@ -108,13 +108,13 @@ public class BlobStringType extends AbstractLobType {
|
||||
/**
|
||||
* Determine the character encoding to apply to the BLOB's bytes
|
||||
* to turn them into a String.
|
||||
* <p>Default is <code>null</code>, indicating to use the platform
|
||||
* <p>Default is {@code null}, indicating to use the platform
|
||||
* default encoding. To be overridden in subclasses for a specific
|
||||
* encoding such as "ISO-8859-1" or "UTF-8".
|
||||
* @return the character encoding to use, or <code>null</code>
|
||||
* @return the character encoding to use, or {@code null}
|
||||
* to use the platform default encoding
|
||||
* @see java.lang.String#String(byte[], String)
|
||||
* @see java.lang.String#getBytes(String)
|
||||
* @see String#String(byte[], String)
|
||||
* @see String#getBytes(String)
|
||||
*/
|
||||
protected String getCharacterEncoding() {
|
||||
return null;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ClobStringType extends AbstractLobType {
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler
|
||||
* and an explicit JTA TransactionManager (can be <code>null</code>).
|
||||
* and an explicit JTA TransactionManager (can be {@code null}).
|
||||
*/
|
||||
protected ClobStringType(LobHandler lobHandler, TransactionManager jtaTransactionManager) {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
|
||||
@@ -105,7 +105,7 @@ public abstract class HibernateDaoSupport extends DaoSupport {
|
||||
* You may introspect its configuration, but not modify the configuration
|
||||
* (other than from within an {@link #initDao} implementation).
|
||||
* Consider creating a custom HibernateTemplate instance via
|
||||
* <code>new HibernateTemplate(getSessionFactory())</code>, in which
|
||||
* {@code new HibernateTemplate(getSessionFactory())}, in which
|
||||
* case you're allowed to customize the settings on the resulting instance.
|
||||
*/
|
||||
public final HibernateTemplate getHibernateTemplate() {
|
||||
@@ -175,7 +175,7 @@ public abstract class HibernateDaoSupport extends DaoSupport {
|
||||
|
||||
/**
|
||||
* Convert the given HibernateException to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy. Will automatically detect
|
||||
* {@code org.springframework.dao} hierarchy. Will automatically detect
|
||||
* wrapped SQLExceptions and convert them accordingly.
|
||||
* <p>Delegates to the
|
||||
* {@link org.springframework.orm.hibernate3.HibernateTemplate#convertHibernateAccessException}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||
/**
|
||||
* Extension of Hibernate's DefaultMergeEventListener, transferring the ids
|
||||
* of newly saved objects to the corresponding original objects (that are part
|
||||
* of the detached object graph passed into the <code>merge</code> method).
|
||||
* of the detached object graph passed into the {@code merge} method).
|
||||
*
|
||||
* <p>Transferring newly assigned ids to the original graph allows for continuing
|
||||
* to use the original object graph, despite merged copies being registered with
|
||||
@@ -37,10 +37,10 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||
*
|
||||
* <p>The merge behavior given by this MergeEventListener is nearly identical
|
||||
* to TopLink's merge behavior. See PetClinic for an example, which relies on
|
||||
* ids being available for newly saved objects: the <code>HibernateClinic</code>
|
||||
* and <code>TopLinkClinic</code> DAO implementations both use straight merge
|
||||
* ids being available for newly saved objects: the {@code HibernateClinic}
|
||||
* and {@code TopLinkClinic} DAO implementations both use straight merge
|
||||
* calls, with the Hibernate SessionFactory configuration specifying an
|
||||
* <code>IdTransferringMergeEventListener</code>.
|
||||
* {@code IdTransferringMergeEventListener}.
|
||||
*
|
||||
* <p>Typically specified as entry for LocalSessionFactoryBean's "eventListeners"
|
||||
* map, with key "merge".
|
||||
|
||||
@@ -53,11 +53,11 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
||||
* as for non-transactional execution (if configured appropriately).
|
||||
*
|
||||
* <p><b>NOTE</b>: This filter will by default <i>not</i> flush the Hibernate Session,
|
||||
* with the flush mode set to <code>FlushMode.NEVER</code>. It assumes to be used
|
||||
* with the flush mode set to {@code FlushMode.NEVER}. It assumes to be used
|
||||
* in combination with service layer transactions that care for the flushing: The
|
||||
* active transaction manager will temporarily change the flush mode to
|
||||
* <code>FlushMode.AUTO</code> during a read-write transaction, with the flush
|
||||
* mode reset to <code>FlushMode.NEVER</code> at the end of each transaction.
|
||||
* {@code FlushMode.AUTO} during a read-write transaction, with the flush
|
||||
* mode reset to {@code FlushMode.NEVER} at the end of each transaction.
|
||||
* If you intend to use this filter without transactions, consider changing
|
||||
* the default flush mode (through the "flushMode" property).
|
||||
*
|
||||
@@ -74,13 +74,13 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
||||
* for deferred close, though, actually processed at request completion.
|
||||
*
|
||||
* <p>A single session per request allows for most efficient first-level caching,
|
||||
* but can cause side effects, for example on <code>saveOrUpdate</code> or when
|
||||
* but can cause side effects, for example on {@code saveOrUpdate} or when
|
||||
* continuing after a rolled-back transaction. The deferred close strategy is as safe
|
||||
* as no Open Session in View in that respect, while still allowing for lazy loading
|
||||
* in views (but not providing a first-level cache for the entire request).
|
||||
*
|
||||
* <p>Looks up the SessionFactory in Spring's root web application context.
|
||||
* Supports a "sessionFactoryBeanName" filter init-param in <code>web.xml</code>;
|
||||
* Supports a "sessionFactoryBeanName" filter init-param in {@code web.xml};
|
||||
* the default bean name is "sessionFactory". Looks up the SessionFactory on each
|
||||
* request, to avoid initialization order issues (when using ContextLoaderServlet,
|
||||
* the root application context will get initialized <i>after</i> this filter).
|
||||
@@ -282,8 +282,8 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter {
|
||||
* Get a Session for the SessionFactory that this filter uses.
|
||||
* Note that this just applies in single session mode!
|
||||
* <p>The default implementation delegates to the
|
||||
* <code>SessionFactoryUtils.getSession</code> method and
|
||||
* sets the <code>Session</code>'s flush mode to "MANUAL".
|
||||
* {@code SessionFactoryUtils.getSession} method and
|
||||
* sets the {@code Session}'s flush mode to "MANUAL".
|
||||
* <p>Can be overridden in subclasses for creating a Session with a
|
||||
* custom entity interceptor or JDBC exception translator.
|
||||
* @param sessionFactory the SessionFactory that this filter uses
|
||||
|
||||
@@ -34,14 +34,14 @@ import org.springframework.web.context.request.async.WebAsyncManager;
|
||||
import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
|
||||
/**
|
||||
* Spring web request interceptor that binds a Hibernate <code>Session</code> to the
|
||||
* Spring web request interceptor that binds a Hibernate {@code Session} to the
|
||||
* thread for the entire processing of the request.
|
||||
*
|
||||
* <p>This class is a concrete expression of the "Open Session in View" pattern, which
|
||||
* is a pattern that allows for the lazy loading of associations in web views despite
|
||||
* the original transactions already being completed.
|
||||
*
|
||||
* <p>This interceptor makes Hibernate <code>Sessions</code> available via the current
|
||||
* <p>This interceptor makes Hibernate {@code Sessions} available via the current
|
||||
* thread, which will be autodetected by transaction managers. It is suitable for
|
||||
* service layer transactions via
|
||||
* {@link org.springframework.orm.hibernate3.HibernateTransactionManager} or
|
||||
@@ -49,11 +49,11 @@ import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
* non-transactional execution (if configured appropriately).
|
||||
*
|
||||
* <p><b>NOTE</b>: This interceptor will by default <i>not</i> flush the Hibernate
|
||||
* <code>Session</code>, with the flush mode being set to <code>FlushMode.NEVER</code>.
|
||||
* {@code Session}, with the flush mode being set to {@code FlushMode.NEVER}.
|
||||
* It assumes that it will be used in combination with service layer transactions
|
||||
* that handle the flushing: the active transaction manager will temporarily change
|
||||
* the flush mode to <code>FlushMode.AUTO</code> during a read-write transaction,
|
||||
* with the flush mode reset to <code>FlushMode.NEVER</code> at the end of each
|
||||
* the flush mode to {@code FlushMode.AUTO} during a read-write transaction,
|
||||
* with the flush mode reset to {@code FlushMode.NEVER} at the end of each
|
||||
* transaction. If you intend to use this interceptor without transactions, consider
|
||||
* changing the default flush mode (through the
|
||||
* {@link #setFlushMode(int) "flushMode"} property).
|
||||
@@ -66,8 +66,8 @@ import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
*
|
||||
* <p><b>WARNING:</b> Applying this interceptor to existing logic can cause issues
|
||||
* that have not appeared before, through the use of a single Hibernate
|
||||
* <code>Session</code> for the processing of an entire request. In particular, the
|
||||
* reassociation of persistent objects with a Hibernate <code>Session</code> has to
|
||||
* {@code Session} for the processing of an entire request. In particular, the
|
||||
* reassociation of persistent objects with a Hibernate {@code Session} has to
|
||||
* occur at the very beginning of request processing, to avoid clashes with already
|
||||
* loaded instances of the same objects.
|
||||
*
|
||||
@@ -79,7 +79,7 @@ import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
* request completion.
|
||||
*
|
||||
* <p>A single session per request allows for the most efficient first-level caching,
|
||||
* but can cause side effects, for example on <code>saveOrUpdate</code> or when
|
||||
* but can cause side effects, for example on {@code saveOrUpdate} or when
|
||||
* continuing after a rolled-back transaction. The deferred close strategy is as safe
|
||||
* as no Open Session in View in that respect, while still allowing for lazy loading
|
||||
* in views (but not providing a first-level cache for the entire request).
|
||||
@@ -97,8 +97,8 @@ import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
public class OpenSessionInViewInterceptor extends HibernateAccessor implements AsyncWebRequestInterceptor {
|
||||
|
||||
/**
|
||||
* Suffix that gets appended to the <code>SessionFactory</code>
|
||||
* <code>toString()</code> representation for the "participate in existing
|
||||
* Suffix that gets appended to the {@code SessionFactory}
|
||||
* {@code toString()} representation for the "participate in existing
|
||||
* session handling" request attribute.
|
||||
* @see #getParticipateAttributeName
|
||||
*/
|
||||
@@ -109,8 +109,8 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
|
||||
|
||||
/**
|
||||
* Create a new <code>OpenSessionInViewInterceptor</code>,
|
||||
* turning the default flushMode to <code>FLUSH_NEVER</code>.
|
||||
* Create a new {@code OpenSessionInViewInterceptor},
|
||||
* turning the default flushMode to {@code FLUSH_NEVER}.
|
||||
* @see #setFlushMode
|
||||
*/
|
||||
public OpenSessionInViewInterceptor() {
|
||||
@@ -139,8 +139,8 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
|
||||
|
||||
/**
|
||||
* Open a new Hibernate <code>Session</code> according to the settings of this
|
||||
* <code>HibernateAccessor</code> and bind it to the thread via the
|
||||
* Open a new Hibernate {@code Session} according to the settings of this
|
||||
* {@code HibernateAccessor} and bind it to the thread via the
|
||||
* {@link TransactionSynchronizationManager}.
|
||||
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
|
||||
*/
|
||||
@@ -183,9 +183,9 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the Hibernate <code>Session</code> before view rendering, if necessary.
|
||||
* Flush the Hibernate {@code Session} before view rendering, if necessary.
|
||||
* <p>Note that this just applies in {@link #isSingleSession() single session mode}!
|
||||
* <p>The default is <code>FLUSH_NEVER</code> to avoid this extra flushing,
|
||||
* <p>The default is {@code FLUSH_NEVER} to avoid this extra flushing,
|
||||
* assuming that service layer transactions have flushed their changes on commit.
|
||||
* @see #setFlushMode
|
||||
*/
|
||||
@@ -205,7 +205,7 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
}
|
||||
|
||||
/**
|
||||
* Unbind the Hibernate <code>Session</code> from the thread and close it (in
|
||||
* Unbind the Hibernate {@code Session} from the thread and close it (in
|
||||
* single session mode), or process deferred close for all sessions that have
|
||||
* been opened during the current request (in deferred close mode).
|
||||
* @see org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
@@ -257,8 +257,8 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
/**
|
||||
* Return the name of the request attribute that identifies that a request is
|
||||
* already intercepted.
|
||||
* <p>The default implementation takes the <code>toString()</code> representation
|
||||
* of the <code>SessionFactory</code> instance and appends {@link #PARTICIPATE_SUFFIX}.
|
||||
* <p>The default implementation takes the {@code toString()} representation
|
||||
* of the {@code SessionFactory} instance and appends {@link #PARTICIPATE_SUFFIX}.
|
||||
*/
|
||||
protected String getParticipateAttributeName() {
|
||||
return getSessionFactory().toString() + PARTICIPATE_SUFFIX;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Classes supporting the <code>org.springframework.orm.hibernate3</code> package.
|
||||
* Classes supporting the {@code org.springframework.orm.hibernate3} package.
|
||||
* Contains a DAO base class for HibernateTemplate usage.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.ibatis.sqlmap.client.SqlMapExecutor;
|
||||
/**
|
||||
* Callback interface for data access code that works with the iBATIS
|
||||
* {@link com.ibatis.sqlmap.client.SqlMapExecutor} interface. To be used
|
||||
* with {@link SqlMapClientTemplate}'s <code>execute</code> method,
|
||||
* with {@link SqlMapClientTemplate}'s {@code execute} method,
|
||||
* assumably often as anonymous classes within a method implementation.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
@@ -37,9 +37,9 @@ import com.ibatis.sqlmap.client.SqlMapExecutor;
|
||||
public interface SqlMapClientCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>SqlMapClientTemplate.execute</code> with an active
|
||||
* <code>SqlMapExecutor</code>. Does not need to care about activating
|
||||
* or closing the <code>SqlMapExecutor</code>, or handling transactions.
|
||||
* Gets called by {@code SqlMapClientTemplate.execute} with an active
|
||||
* {@code SqlMapExecutor}. Does not need to care about activating
|
||||
* or closing the {@code SqlMapExecutor}, or handling transactions.
|
||||
*
|
||||
* <p>If called without a thread-bound JDBC transaction (initiated by
|
||||
* DataSourceTransactionManager), the code will simply get executed on the
|
||||
@@ -54,7 +54,7 @@ public interface SqlMapClientCallback<T> {
|
||||
*
|
||||
* @param executor an active iBATIS SqlMapSession, passed-in as
|
||||
* SqlMapExecutor interface here to avoid manual lifecycle handling
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws SQLException if thrown by the iBATIS SQL Maps API
|
||||
* @see SqlMapClientTemplate#execute
|
||||
* @see SqlMapClientTemplate#executeWithListResult
|
||||
|
||||
@@ -147,7 +147,7 @@ public class SqlMapClientFactoryBean implements FactoryBean<SqlMapClient>, Initi
|
||||
|
||||
/**
|
||||
* Set optional properties to be passed into the SqlMapClientBuilder, as
|
||||
* alternative to a <code><properties></code> tag in the sql-map-config.xml
|
||||
* alternative to a {@code <properties>} tag in the sql-map-config.xml
|
||||
* file. Will be used to resolve placeholders in the config file.
|
||||
* @see #setConfigLocation
|
||||
* @see com.ibatis.sqlmap.client.SqlMapClientBuilder#buildSqlMapClient(java.io.InputStream, java.util.Properties)
|
||||
@@ -205,7 +205,7 @@ public class SqlMapClientFactoryBean implements FactoryBean<SqlMapClient>, Initi
|
||||
|
||||
/**
|
||||
* Set the iBATIS TransactionConfig class to use. Default is
|
||||
* <code>com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig</code>.
|
||||
* {@code com.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig}.
|
||||
* <p>Will only get applied when using a Spring-managed DataSource.
|
||||
* An instance of this class will get populated with the given DataSource
|
||||
* and initialized with the given properties.
|
||||
@@ -235,7 +235,7 @@ public class SqlMapClientFactoryBean implements FactoryBean<SqlMapClient>, Initi
|
||||
* @see com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransactionConfig
|
||||
* @see com.ibatis.sqlmap.engine.transaction.jta.JtaTransactionConfig
|
||||
* @see com.ibatis.sqlmap.client.SqlMapTransactionManager
|
||||
*/
|
||||
*/
|
||||
public void setTransactionConfigClass(Class transactionConfigClass) {
|
||||
if (transactionConfigClass == null || !TransactionConfig.class.isAssignableFrom(transactionConfigClass)) {
|
||||
throw new IllegalArgumentException("Invalid transactionConfigClass: does not implement " +
|
||||
@@ -320,7 +320,7 @@ public class SqlMapClientFactoryBean implements FactoryBean<SqlMapClient>, Initi
|
||||
* on iBATIS 2.3 and higher) or on a Reader (on iBATIS up to version 2.2).
|
||||
* @param configLocations the config files to load from
|
||||
* @param properties the SqlMapClient properties (if any)
|
||||
* @return the SqlMapClient instance (never <code>null</code>)
|
||||
* @return the SqlMapClient instance (never {@code null})
|
||||
* @throws IOException if loading the config file failed
|
||||
* @see com.ibatis.sqlmap.client.SqlMapClientBuilder#buildSqlMapClient
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.Assert;
|
||||
* Helper class that simplifies data access via the iBATIS
|
||||
* {@link com.ibatis.sqlmap.client.SqlMapClient} API, converting checked
|
||||
* SQLExceptions into unchecked DataAccessExceptions, following the
|
||||
* <code>org.springframework.dao</code> exception hierarchy.
|
||||
* {@code org.springframework.dao} exception hierarchy.
|
||||
* Uses the same {@link org.springframework.jdbc.support.SQLExceptionTranslator}
|
||||
* mechanism as {@link org.springframework.jdbc.core.JdbcTemplate}.
|
||||
*
|
||||
@@ -61,7 +61,7 @@ import org.springframework.util.Assert;
|
||||
* executor.update("insertSomethingElse", "myOtherParamValue");
|
||||
* executor.executeBatch();
|
||||
* return null;
|
||||
* }
|
||||
* }
|
||||
* });</pre>
|
||||
*
|
||||
* The template needs a SqlMapClient to work on, passed in via the "sqlMapClient"
|
||||
@@ -152,7 +152,7 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
/**
|
||||
* Execute the given data access action on a SqlMapExecutor.
|
||||
* @param action callback object that specifies the data access action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws DataAccessException in case of SQL Maps errors
|
||||
*/
|
||||
public <T> T execute(SqlMapClientCallback<T> action) throws DataAccessException {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Classes supporting the <code>org.springframework.orm.ibatis</code> package.
|
||||
* Classes supporting the {@code org.springframework.orm.ibatis} package.
|
||||
* Contains a DAO base class for SqlMapClientTemplate usage.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -43,16 +43,16 @@ import org.springframework.util.ReflectionUtils;
|
||||
* Updated to build on JDO 2.0 or higher, as of Spring 2.5.
|
||||
* Used as default dialect by {@link JdoAccessor} and {@link JdoTransactionManager}.
|
||||
*
|
||||
* <p>Simply begins a standard JDO transaction in <code>beginTransaction</code>.
|
||||
* Returns a handle for a JDO2 DataStoreConnection on <code>getJdbcConnection</code>.
|
||||
* Calls the corresponding JDO2 PersistenceManager operation on <code>flush</code>
|
||||
* Ignores a given query timeout in <code>applyQueryTimeout</code>.
|
||||
* <p>Simply begins a standard JDO transaction in {@code beginTransaction}.
|
||||
* Returns a handle for a JDO2 DataStoreConnection on {@code getJdbcConnection}.
|
||||
* Calls the corresponding JDO2 PersistenceManager operation on {@code flush}
|
||||
* Ignores a given query timeout in {@code applyQueryTimeout}.
|
||||
* Uses a Spring SQLExceptionTranslator for exception translation, if applicable.
|
||||
*
|
||||
* <p>Note that, even with JDO2, vendor-specific subclasses are still necessary
|
||||
* for special transaction semantics and more sophisticated exception translation.
|
||||
* Furthermore, vendor-specific subclasses are encouraged to expose the native JDBC
|
||||
* Connection on <code>getJdbcConnection</code>, rather than JDO2's wrapper handle.
|
||||
* Connection on {@code getJdbcConnection}, rather than JDO2's wrapper handle.
|
||||
*
|
||||
* <p>This class also implements the PersistenceExceptionTranslator interface,
|
||||
* as autodetected by Spring's PersistenceExceptionTranslationPostProcessor,
|
||||
@@ -122,7 +122,7 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This implementation invokes the standard JDO <code>Transaction.begin</code>
|
||||
* This implementation invokes the standard JDO {@code Transaction.begin}
|
||||
* method. Throws an InvalidIsolationLevelException if a non-default isolation
|
||||
* level is set.
|
||||
* @see javax.jdo.Transaction#begin
|
||||
@@ -152,7 +152,7 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* This implementation returns a DataStoreConnectionHandle for JDO2,
|
||||
* which will also work on JDO1 until actually accessing the JDBC Connection.
|
||||
* <p>For pre-JDO2 implementations, override this method to return the
|
||||
* Connection through the corresponding vendor-specific mechanism, or <code>null</code>
|
||||
* Connection through the corresponding vendor-specific mechanism, or {@code null}
|
||||
* if the Connection is not retrievable.
|
||||
* <p><b>NOTE:</b> A JDO2 DataStoreConnection is always a wrapper,
|
||||
* never the native JDBC Connection. If you need access to the native JDBC
|
||||
@@ -164,7 +164,7 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* fetched Connection to be closed before continuing PersistenceManager work.
|
||||
* For this reason, the exposed ConnectionHandle eagerly releases its JDBC
|
||||
* Connection at the end of each JDBC data access operation (that is, on
|
||||
* <code>DataSourceUtils.releaseConnection</code>).
|
||||
* {@code DataSourceUtils.releaseConnection}).
|
||||
* @see javax.jdo.PersistenceManager#getDataStoreConnection()
|
||||
* @see org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor
|
||||
* @see org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection
|
||||
@@ -180,7 +180,7 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* will implicitly be closed with the PersistenceManager.
|
||||
* <p>If the JDO provider returns a Connection handle that it
|
||||
* expects the application to close, the dialect needs to invoke
|
||||
* <code>Connection.close</code> here.
|
||||
* {@code Connection.close} here.
|
||||
* @see java.sql.Connection#close()
|
||||
*/
|
||||
public void releaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager pm)
|
||||
@@ -212,7 +212,7 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* Implementation of the PersistenceExceptionTranslator interface,
|
||||
* as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.
|
||||
* <p>Converts the exception if it is a JDOException, using this JdoDialect.
|
||||
* Else returns <code>null</code> to indicate an unknown exception.
|
||||
* Else returns {@code null} to indicate an unknown exception.
|
||||
* @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
|
||||
* @see #translateException
|
||||
*/
|
||||
@@ -237,10 +237,10 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
|
||||
/**
|
||||
* Template method for extracting a SQL String from the given exception.
|
||||
* <p>Default implementation always returns <code>null</code>. Can be overridden in
|
||||
* <p>Default implementation always returns {@code null}. Can be overridden in
|
||||
* subclasses to extract SQL Strings for vendor-specific exception classes.
|
||||
* @param ex the JDOException, containing a SQLException
|
||||
* @return the SQL String, or <code>null</code> if none found
|
||||
* @return the SQL String, or {@code null} if none found
|
||||
*/
|
||||
protected String extractSqlStringFromException(JDOException ex) {
|
||||
return null;
|
||||
@@ -249,8 +249,8 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
|
||||
/**
|
||||
* ConnectionHandle implementation that fetches a new JDO2 DataStoreConnection
|
||||
* for every <code>getConnection</code> call and closes the Connection on
|
||||
* <code>releaseConnection</code>. This is necessary because JDO2 requires the
|
||||
* for every {@code getConnection} call and closes the Connection on
|
||||
* {@code releaseConnection}. This is necessary because JDO2 requires the
|
||||
* fetched Connection to be closed before continuing PersistenceManager work.
|
||||
* @see javax.jdo.PersistenceManager#getDataStoreConnection()
|
||||
*/
|
||||
|
||||
@@ -158,7 +158,7 @@ public abstract class JdoAccessor implements InitializingBean {
|
||||
|
||||
/**
|
||||
* Convert the given JDOException to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy.
|
||||
* {@code org.springframework.dao} hierarchy.
|
||||
* <p>Default implementation delegates to the JdoDialect.
|
||||
* May be overridden in subclasses.
|
||||
* @param ex JDOException that occured
|
||||
|
||||
@@ -48,9 +48,9 @@ import javax.jdo.PersistenceManager;
|
||||
public interface JdoCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>JdoTemplate.execute</code> with an active JDO
|
||||
* <code>PersistenceManager</code>. Does not need to care about activating
|
||||
* or closing the <code>PersistenceManager</code>, or handling transactions.
|
||||
* Gets called by {@code JdoTemplate.execute} with an active JDO
|
||||
* {@code PersistenceManager}. Does not need to care about activating
|
||||
* or closing the {@code PersistenceManager}, or handling transactions.
|
||||
*
|
||||
* <p>Note that JDO callback code will not flush any modifications to the
|
||||
* database if not executed within a transaction. Thus, you need to make
|
||||
@@ -63,7 +63,7 @@ public interface JdoCallback<T> {
|
||||
* It gets propagated to the caller of the template.
|
||||
*
|
||||
* @param pm active PersistenceManager
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws JDOException if thrown by the JDO API
|
||||
* @see JdoTemplate#execute
|
||||
* @see JdoTemplate#executeFind
|
||||
|
||||
@@ -60,12 +60,12 @@ public interface JdoDialect {
|
||||
* given Spring transaction definition (in particular, an isolation level
|
||||
* and a timeout). Invoked by JdoTransactionManager on transaction begin.
|
||||
* <p>An implementation can configure the JDO Transaction object and then
|
||||
* invoke <code>begin</code>, or invoke a special begin method that takes,
|
||||
* invoke {@code begin}, or invoke a special begin method that takes,
|
||||
* for example, an isolation level.
|
||||
* <p>An implementation can also apply read-only flag and isolation level to the
|
||||
* underlying JDBC Connection before beginning the transaction. In that case,
|
||||
* a transaction data object can be returned that holds the previous isolation
|
||||
* level (and possibly other data), to be reset in <code>cleanupTransaction</code>.
|
||||
* level (and possibly other data), to be reset in {@code cleanupTransaction}.
|
||||
* <p>Implementations can also use the Spring transaction name, as exposed by the
|
||||
* passed-in TransactionDefinition, to optimize for specific data access use cases
|
||||
* (effectively using the current transaction name as use case identifier).
|
||||
@@ -101,7 +101,7 @@ public interface JdoDialect {
|
||||
* if accessing a relational database. This method will just get invoked if actually
|
||||
* needing access to the underlying JDBC Connection, usually within an active JDO
|
||||
* transaction (for example, by JdoTransactionManager). The returned handle will
|
||||
* be passed into the <code>releaseJdbcConnection</code> method when not needed anymore.
|
||||
* be passed into the {@code releaseJdbcConnection} method when not needed anymore.
|
||||
* <p>Implementations are encouraged to return an unwrapped Connection object, i.e.
|
||||
* the Connection as they got it from the connection pool. This makes it easier for
|
||||
* application code to get at the underlying native JDBC Connection, like an
|
||||
@@ -110,12 +110,12 @@ public interface JdoDialect {
|
||||
* <p>In a simple case where the returned Connection will be auto-closed with the
|
||||
* PersistenceManager or can be released via the Connection object itself, an
|
||||
* implementation can return a SimpleConnectionHandle that just contains the
|
||||
* Connection. If some other object is needed in <code>releaseJdbcConnection</code>,
|
||||
* Connection. If some other object is needed in {@code releaseJdbcConnection},
|
||||
* an implementation should use a special handle that references that other object.
|
||||
* @param pm the current JDO PersistenceManager
|
||||
* @param readOnly whether the Connection is only needed for read-only purposes
|
||||
* @return a handle for the JDBC Connection, to be passed into
|
||||
* <code>releaseJdbcConnection</code>, or <code>null</code>
|
||||
* {@code releaseJdbcConnection}, or {@code null}
|
||||
* if no JDBC Connection can be retrieved
|
||||
* @throws JDOException if thrown by JDO methods
|
||||
* @throws SQLException if thrown by JDBC methods
|
||||
@@ -130,10 +130,10 @@ public interface JdoDialect {
|
||||
|
||||
/**
|
||||
* Release the given JDBC Connection, which has originally been retrieved
|
||||
* via <code>getJdbcConnection</code>. This should be invoked in any case,
|
||||
* via {@code getJdbcConnection}. This should be invoked in any case,
|
||||
* to allow for proper release of the retrieved Connection handle.
|
||||
* <p>An implementation might simply do nothing, if the Connection returned
|
||||
* by <code>getJdbcConnection</code> will be implicitly closed when the JDO
|
||||
* by {@code getJdbcConnection} will be implicitly closed when the JDO
|
||||
* transaction completes or when the PersistenceManager is closed.
|
||||
* @param conHandle the JDBC Connection handle to release
|
||||
* @param pm the current JDO PersistenceManager
|
||||
@@ -170,7 +170,7 @@ public interface JdoDialect {
|
||||
* <p>Can use a SQLExceptionTranslator for translating underlying SQLExceptions
|
||||
* in a database-specific fashion.
|
||||
* @param ex the JDOException thrown
|
||||
* @return the corresponding DataAccessException (must not be <code>null</code>)
|
||||
* @return the corresponding DataAccessException (must not be {@code null})
|
||||
* @see JdoAccessor#convertJdoAccessException
|
||||
* @see JdoTransactionManager#convertJdoAccessException
|
||||
* @see PersistenceManagerFactoryUtils#convertJdoAccessException
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* or from a surrounding JDO-intercepted method), the interceptor simply participates in it.
|
||||
*
|
||||
* <p>Application code must retrieve a JDO PersistenceManager via the
|
||||
* <code>PersistenceManagerFactoryUtils.getPersistenceManager</code> method,
|
||||
* {@code PersistenceManagerFactoryUtils.getPersistenceManager} method,
|
||||
* to be able to detect a thread-bound PersistenceManager. It is preferable to use
|
||||
* <code>getPersistenceManager</code> with allowCreate=false, if the code relies on
|
||||
* {@code getPersistenceManager} with allowCreate=false, if the code relies on
|
||||
* the interceptor to provide proper PersistenceManager handling. Typically, the code
|
||||
* will look like as follows:
|
||||
*
|
||||
@@ -44,9 +44,9 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* }</pre>
|
||||
*
|
||||
* <p>Note that this interceptor automatically translates JDOExceptions, via
|
||||
* delegating to the <code>PersistenceManagerFactoryUtils.convertJdoAccessException</code>
|
||||
* delegating to the {@code PersistenceManagerFactoryUtils.convertJdoAccessException}
|
||||
* method that converts them to exceptions that are compatible with the
|
||||
* <code>org.springframework.dao</code> exception hierarchy (like JdoTemplate does).
|
||||
* {@code org.springframework.dao} exception hierarchy (like JdoTemplate does).
|
||||
* This can be turned off if the raw exceptions are preferred.
|
||||
*
|
||||
* <p>This class can be considered a declarative alternative to JdoTemplate's
|
||||
@@ -80,7 +80,7 @@ public class JdoInterceptor extends JdoAccessor implements MethodInterceptor {
|
||||
|
||||
/**
|
||||
* Set whether to convert any JDOException raised to a Spring DataAccessException,
|
||||
* compatible with the <code>org.springframework.dao</code> exception hierarchy.
|
||||
* compatible with the {@code org.springframework.dao} exception hierarchy.
|
||||
* <p>Default is "true". Turn this flag off to let the caller receive raw exceptions
|
||||
* as-is, without any wrapping.
|
||||
* @see org.springframework.dao.DataAccessException
|
||||
|
||||
@@ -26,17 +26,17 @@ import org.springframework.dao.DataAccessException;
|
||||
* implemented by {@link JdoTemplate}. Not often used, but a useful
|
||||
* option to enhance testability, as it can easily be mocked or stubbed.
|
||||
*
|
||||
* <p>Defines <code>JdoTemplate</code>'s data access methods that mirror
|
||||
* <p>Defines {@code JdoTemplate}'s data access methods that mirror
|
||||
* various JDO {@link javax.jdo.PersistenceManager} methods. Users are
|
||||
* strongly encouraged to read the JDO <code>PersistenceManager</code>
|
||||
* strongly encouraged to read the JDO {@code PersistenceManager}
|
||||
* javadocs for details on the semantics of those methods.
|
||||
*
|
||||
* <p>Note that lazy loading will just work with an open JDO
|
||||
* <code>PersistenceManager</code>, either within a managed transaction or within
|
||||
* {@code PersistenceManager}, either within a managed transaction or within
|
||||
* {@link org.springframework.orm.jdo.support.OpenPersistenceManagerInViewFilter}/
|
||||
* {@link org.springframework.orm.jdo.support.OpenPersistenceManagerInViewInterceptor}.
|
||||
* Furthermore, some operations just make sense within transactions,
|
||||
* for example: <code>evict</code>, <code>evictAll</code>, <code>flush</code>.
|
||||
* for example: {@code evict}, {@code evictAll}, {@code flush}.
|
||||
*
|
||||
* <p>Updated to build on JDO 2.0 or higher, as of Spring 2.5.
|
||||
*
|
||||
@@ -64,7 +64,7 @@ public interface JdoOperations {
|
||||
* <p>Note: Callback code is not supposed to handle transactions itself!
|
||||
* Use an appropriate transaction manager like JdoTransactionManager.
|
||||
* @param action callback object that specifies the JDO action
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
* @see JdoTransactionManager
|
||||
* @see javax.jdo.PersistenceManager
|
||||
@@ -76,7 +76,7 @@ public interface JdoOperations {
|
||||
* Collection. This is a convenience method for executing JDO queries
|
||||
* within an action.
|
||||
* @param action callback object that specifies the JDO action
|
||||
* @return a Collection result returned by the action, or <code>null</code>
|
||||
* @return a Collection result returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
*/
|
||||
Collection executeFind(JdoCallback<?> action) throws DataAccessException;
|
||||
@@ -247,7 +247,7 @@ public interface JdoOperations {
|
||||
* Find all persistent instances of the given class that match the given
|
||||
* JDOQL filter.
|
||||
* @param entityClass a persistent class
|
||||
* @param filter the JDOQL filter to match (or <code>null</code> if none)
|
||||
* @param filter the JDOQL filter to match (or {@code null} if none)
|
||||
* @return the persistent instances
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
* @see javax.jdo.PersistenceManager#newQuery(Class, String)
|
||||
@@ -258,8 +258,8 @@ public interface JdoOperations {
|
||||
* Find all persistent instances of the given class that match the given
|
||||
* JDOQL filter, with the given result ordering.
|
||||
* @param entityClass a persistent class
|
||||
* @param filter the JDOQL filter to match (or <code>null</code> if none)
|
||||
* @param ordering the ordering of the result (or <code>null</code> if none)
|
||||
* @param filter the JDOQL filter to match (or {@code null} if none)
|
||||
* @param ordering the ordering of the result (or {@code null} if none)
|
||||
* @return the persistent instances
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
* @see javax.jdo.PersistenceManager#newQuery(Class, String)
|
||||
@@ -291,7 +291,7 @@ public interface JdoOperations {
|
||||
* @param filter the JDOQL filter to match
|
||||
* @param parameters the JDOQL parameter declarations
|
||||
* @param values the corresponding parameter values
|
||||
* @param ordering the ordering of the result (or <code>null</code> if none)
|
||||
* @param ordering the ordering of the result (or {@code null} if none)
|
||||
* @return the persistent instances
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
* @see javax.jdo.PersistenceManager#newQuery(Class, String)
|
||||
@@ -327,7 +327,7 @@ public interface JdoOperations {
|
||||
* @param filter the JDOQL filter to match
|
||||
* @param parameters the JDOQL parameter declarations
|
||||
* @param values a Map with parameter names as keys and parameter values
|
||||
* @param ordering the ordering of the result (or <code>null</code> if none)
|
||||
* @param ordering the ordering of the result (or {@code null} if none)
|
||||
* @return the persistent instances
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
* @see javax.jdo.PersistenceManager#newQuery(Class, String)
|
||||
@@ -342,8 +342,8 @@ public interface JdoOperations {
|
||||
/**
|
||||
* Find persistent instances through the given query object
|
||||
* in the specified query language.
|
||||
* @param language the query language (<code>javax.jdo.Query#JDOQL</code>
|
||||
* or <code>javax.jdo.Query#SQL</code>, for example)
|
||||
* @param language the query language ({@code javax.jdo.Query#JDOQL}
|
||||
* or {@code javax.jdo.Query#SQL}, for example)
|
||||
* @param queryObject the query object for the specified language
|
||||
* @return the persistent instances
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.dao.UncategorizedDataAccessException;
|
||||
/**
|
||||
* JDO-specific subclass of UncategorizedDataAccessException,
|
||||
* for JDO system errors that do not match any concrete
|
||||
* <code>org.springframework.dao</code> exceptions.
|
||||
* {@code org.springframework.dao} exceptions.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 03.06.2003
|
||||
|
||||
@@ -36,9 +36,9 @@ import org.springframework.util.ClassUtils;
|
||||
/**
|
||||
* Helper class that simplifies JDO data access code, and converts
|
||||
* JDOExceptions into Spring DataAccessExceptions, following the
|
||||
* <code>org.springframework.dao</code> exception hierarchy.
|
||||
* {@code org.springframework.dao} exception hierarchy.
|
||||
*
|
||||
* <p>The central method is <code>execute</code>, supporting JDO access code
|
||||
* <p>The central method is {@code execute}, supporting JDO access code
|
||||
* implementing the {@link JdoCallback} interface. It provides JDO PersistenceManager
|
||||
* handling such that neither the JdoCallback implementation nor the calling
|
||||
* code needs to explicitly care about retrieving/closing PersistenceManagers,
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.ClassUtils;
|
||||
* <p>Typically used to implement data access or business logic services that
|
||||
* use JDO within their implementation but are JDO-agnostic in their interface.
|
||||
* The latter or code calling the latter only have to deal with business
|
||||
* objects, query objects, and <code>org.springframework.dao</code> exceptions.
|
||||
* objects, query objects, and {@code org.springframework.dao} exceptions.
|
||||
*
|
||||
* <p>Can be used within a service implementation via direct instantiation
|
||||
* with a PersistenceManagerFactory reference, or get prepared in an
|
||||
@@ -58,7 +58,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* <p>This class can be considered as direct alternative to working with the
|
||||
* raw JDO PersistenceManager API (through
|
||||
* <code>PersistenceManagerFactoryUtils.getPersistenceManager()</code>).
|
||||
* {@code PersistenceManagerFactoryUtils.getPersistenceManager()}).
|
||||
* The major advantage is its automatic conversion to DataAccessExceptions, the
|
||||
* major disadvantage that no checked application exceptions can get thrown from
|
||||
* within data access code. Corresponding checks and the actual throwing of such
|
||||
@@ -73,7 +73,7 @@ import org.springframework.util.ClassUtils;
|
||||
* either within a Spring-driven transaction (with JdoTransactionManager or
|
||||
* JtaTransactionManager) or within OpenPersistenceManagerInViewFilter/Interceptor.
|
||||
* Furthermore, some operations just make sense within transactions,
|
||||
* for example: <code>evict</code>, <code>evictAll</code>, <code>flush</code>.
|
||||
* for example: {@code evict}, {@code evictAll}, {@code flush}.
|
||||
*
|
||||
* <p><b>NOTE: This class requires JDO 2.0 or higher, as of Spring 2.5.</b>
|
||||
* As of Spring 3.0, it follows JDO 2.1 conventions in terms of generic
|
||||
@@ -152,7 +152,7 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
/**
|
||||
* Set whether to expose the native JDO PersistenceManager to JdoCallback
|
||||
* code. Default is "false": a PersistenceManager proxy will be returned,
|
||||
* suppressing <code>close</code> calls and automatically applying transaction
|
||||
* suppressing {@code close} calls and automatically applying transaction
|
||||
* timeouts (if any).
|
||||
* <p>As there is often a need to cast to a provider-specific PersistenceManager
|
||||
* class in DAOs that use provider-specific functionality, the exposed proxy
|
||||
@@ -194,7 +194,7 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
* @param action callback object that specifies the JDO action
|
||||
* @param exposeNativePersistenceManager whether to expose the native
|
||||
* JDO persistence manager to callback code
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of JDO errors
|
||||
*/
|
||||
public <T> T execute(JdoCallback<T> action, boolean exposeNativePersistenceManager) throws DataAccessException {
|
||||
@@ -224,7 +224,7 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
|
||||
/**
|
||||
* Create a close-suppressing proxy for the given JDO PersistenceManager.
|
||||
* Called by the <code>execute</code> method.
|
||||
* Called by the {@code execute} method.
|
||||
* <p>The proxy also prepares returned JDO Query objects.
|
||||
* @param pm the JDO PersistenceManager to create a proxy for
|
||||
* @return the PersistenceManager proxy, implementing all interfaces
|
||||
@@ -242,7 +242,7 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
|
||||
/**
|
||||
* Post-process the given result object, which might be a Collection.
|
||||
* Called by the <code>execute</code> method.
|
||||
* Called by the {@code execute} method.
|
||||
* <p>Default implementation always returns the passed-in Object as-is.
|
||||
* Subclasses might override this to automatically detach result
|
||||
* collections or even single result objects.
|
||||
|
||||
@@ -195,7 +195,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
/**
|
||||
* Set whether to autodetect a JDBC DataSource used by the JDO PersistenceManagerFactory,
|
||||
* as returned by the <code>getConnectionFactory()</code> method. Default is "true".
|
||||
* as returned by the {@code getConnectionFactory()} method. Default is "true".
|
||||
* <p>Can be turned off to deliberately ignore an available DataSource,
|
||||
* to not expose JDO transactions as JDBC transactions for that DataSource.
|
||||
* @see #setDataSource
|
||||
@@ -509,7 +509,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
/**
|
||||
* Convert the given JDOException to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy.
|
||||
* {@code org.springframework.dao} hierarchy.
|
||||
* <p>The default implementation delegates to the JdoDialect.
|
||||
* May be overridden in subclasses.
|
||||
* @param ex JDOException that occured
|
||||
@@ -588,7 +588,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
/**
|
||||
* Holder for suspended resources.
|
||||
* Used internally by <code>doSuspend</code> and <code>doResume</code>.
|
||||
* Used internally by {@code doSuspend} and {@code doResume}.
|
||||
*/
|
||||
private static class SuspendedResourcesHolder {
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ import org.springframework.util.CollectionUtils;
|
||||
* into a JDO PersistenceManagerFactory. With the standard properties-driven approach,
|
||||
* you can only use an internal connection pool or a JNDI DataSource.
|
||||
*
|
||||
* <p>The <code>close()</code> method is standardized in JDO; don't forget to
|
||||
* <p>The {@code close()} method is standardized in JDO; don't forget to
|
||||
* specify it as "destroy-method" for any PersistenceManagerFactory instance.
|
||||
* Note that this FactoryBean will automatically invoke <code>close()</code> for
|
||||
* Note that this FactoryBean will automatically invoke {@code close()} for
|
||||
* the PersistenceManagerFactory that it creates, without any special configuration.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
@@ -164,7 +164,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
|
||||
/**
|
||||
* Specify JDO properties as a Map, to be passed into
|
||||
* <code>JDOHelper.getPersistenceManagerFactory</code> (if any).
|
||||
* {@code JDOHelper.getPersistenceManagerFactory} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.jdo.JDOHelper#getPersistenceManagerFactory(java.util.Map)
|
||||
*/
|
||||
@@ -244,7 +244,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
* Subclasses can override this to perform custom initialization of the
|
||||
* PersistenceManagerFactory instance, creating it for the specified name.
|
||||
* <p>The default implementation invokes JDOHelper's
|
||||
* <code>getPersistenceManagerFactory(String)</code> method.
|
||||
* {@code getPersistenceManagerFactory(String)} method.
|
||||
* A custom implementation could prepare the instance in a specific way,
|
||||
* or use a custom PersistenceManagerFactory implementation.
|
||||
* @param name the name of the desired PersistenceManagerFactory
|
||||
@@ -260,7 +260,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
* PersistenceManagerFactory instance, creating it via the given Properties
|
||||
* that got prepared by this LocalPersistenceManagerFactoryBean.
|
||||
* <p>The default implementation invokes JDOHelper's
|
||||
* <code>getPersistenceManagerFactory(Map)</code> method.
|
||||
* {@code getPersistenceManagerFactory(Map)} method.
|
||||
* A custom implementation could prepare the instance in a specific way,
|
||||
* or use a custom PersistenceManagerFactory implementation.
|
||||
* @param props the merged properties prepared by this LocalPersistenceManagerFactoryBean
|
||||
@@ -293,7 +293,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
* Implementation of the PersistenceExceptionTranslator interface,
|
||||
* as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.
|
||||
* <p>Converts the exception if it is a JDOException, preferably using a specified
|
||||
* JdoDialect. Else returns <code>null</code> to indicate an unknown exception.
|
||||
* JdoDialect. Else returns {@code null} to indicate an unknown exception.
|
||||
* @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
|
||||
* @see JdoDialect#translateException
|
||||
* @see PersistenceManagerFactoryUtils#convertJdoAccessException
|
||||
|
||||
@@ -75,8 +75,8 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
* <p>If a DataSource is found, creates a SQLErrorCodeSQLExceptionTranslator for the
|
||||
* DataSource; else, falls back to a SQLStateSQLExceptionTranslator.
|
||||
* @param connectionFactory the connection factory of the PersistenceManagerFactory
|
||||
* (may be <code>null</code>)
|
||||
* @return the SQLExceptionTranslator (never <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @return the SQLExceptionTranslator (never {@code null})
|
||||
* @see javax.jdo.PersistenceManagerFactory#getConnectionFactory()
|
||||
* @see org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator
|
||||
* @see org.springframework.jdbc.support.SQLStateSQLExceptionTranslator
|
||||
@@ -95,14 +95,14 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
* Obtain a JDO PersistenceManager via the given factory. Is aware of a
|
||||
* corresponding PersistenceManager bound to the current thread,
|
||||
* for example when using JdoTransactionManager. Will create a new
|
||||
* PersistenceManager else, if "allowCreate" is <code>true</code>.
|
||||
* PersistenceManager else, if "allowCreate" is {@code true}.
|
||||
* @param pmf PersistenceManagerFactory to create the PersistenceManager with
|
||||
* @param allowCreate if a non-transactional PersistenceManager should be created
|
||||
* when no transactional PersistenceManager can be found for the current thread
|
||||
* @return the PersistenceManager
|
||||
* @throws DataAccessResourceFailureException if the PersistenceManager couldn't be obtained
|
||||
* @throws IllegalStateException if no thread-bound PersistenceManager found and
|
||||
* "allowCreate" is <code>false</code>
|
||||
* "allowCreate" is {@code false}
|
||||
* @see JdoTransactionManager
|
||||
*/
|
||||
public static PersistenceManager getPersistenceManager(PersistenceManagerFactory pmf, boolean allowCreate)
|
||||
@@ -120,15 +120,15 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
* Obtain a JDO PersistenceManager via the given factory. Is aware of a
|
||||
* corresponding PersistenceManager bound to the current thread,
|
||||
* for example when using JdoTransactionManager. Will create a new
|
||||
* PersistenceManager else, if "allowCreate" is <code>true</code>.
|
||||
* <p>Same as <code>getPersistenceManager</code>, but throwing the original JDOException.
|
||||
* PersistenceManager else, if "allowCreate" is {@code true}.
|
||||
* <p>Same as {@code getPersistenceManager}, but throwing the original JDOException.
|
||||
* @param pmf PersistenceManagerFactory to create the PersistenceManager with
|
||||
* @param allowCreate if a non-transactional PersistenceManager should be created
|
||||
* when no transactional PersistenceManager can be found for the current thread
|
||||
* @return the PersistenceManager
|
||||
* @throws JDOException if the PersistenceManager couldn't be created
|
||||
* @throws IllegalStateException if no thread-bound PersistenceManager found and
|
||||
* "allowCreate" is <code>false</code>
|
||||
* "allowCreate" is {@code false}
|
||||
* @see #getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
|
||||
* @see JdoTransactionManager
|
||||
*/
|
||||
@@ -176,7 +176,7 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
* bound to the current thread by Spring's transaction facilities.
|
||||
* @param pm the JDO PersistenceManager to check
|
||||
* @param pmf JDO PersistenceManagerFactory that the PersistenceManager
|
||||
* was created with (can be <code>null</code>)
|
||||
* was created with (can be {@code null})
|
||||
* @return whether the PersistenceManager is transactional
|
||||
*/
|
||||
public static boolean isPersistenceManagerTransactional(
|
||||
@@ -195,7 +195,7 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
* @param query the JDO Query object
|
||||
* @param pmf JDO PersistenceManagerFactory that the Query was created for
|
||||
* @param jdoDialect the JdoDialect to use for applying a query timeout
|
||||
* (must not be <code>null</code>)
|
||||
* (must not be {@code null})
|
||||
* @throws JDOException if thrown by JDO methods
|
||||
* @see JdoDialect#applyQueryTimeout
|
||||
*/
|
||||
@@ -212,7 +212,7 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
|
||||
/**
|
||||
* Convert the given JDOException to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy.
|
||||
* {@code org.springframework.dao} hierarchy.
|
||||
* <p>The most important cases like object not found or optimistic locking
|
||||
* failure are covered here. For more fine-granular conversion, JdoAccessor and
|
||||
* JdoTransactionManager support sophisticated translation of exceptions via a
|
||||
@@ -251,7 +251,7 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
* if it is not managed externally (i.e. not bound to the thread).
|
||||
* @param pm PersistenceManager to close
|
||||
* @param pmf PersistenceManagerFactory that the PersistenceManager was created with
|
||||
* (can be <code>null</code>)
|
||||
* (can be {@code null})
|
||||
*/
|
||||
public static void releasePersistenceManager(PersistenceManager pm, PersistenceManagerFactory pmf) {
|
||||
try {
|
||||
@@ -267,10 +267,10 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
|
||||
/**
|
||||
* Actually release a PersistenceManager for the given factory.
|
||||
* Same as <code>releasePersistenceManager</code>, but throwing the original JDOException.
|
||||
* Same as {@code releasePersistenceManager}, but throwing the original JDOException.
|
||||
* @param pm PersistenceManager to close
|
||||
* @param pmf PersistenceManagerFactory that the PersistenceManager was created with
|
||||
* (can be <code>null</code>)
|
||||
* (can be {@code null})
|
||||
* @throws JDOException if thrown by JDO methods
|
||||
*/
|
||||
public static void doReleasePersistenceManager(PersistenceManager pm, PersistenceManagerFactory pmf)
|
||||
|
||||
@@ -31,11 +31,11 @@ import org.springframework.util.ClassUtils;
|
||||
* Proxy for a target JDO {@link javax.jdo.PersistenceManagerFactory},
|
||||
* returning the current thread-bound PersistenceManager (the Spring-managed
|
||||
* transactional PersistenceManager or the single OpenPersistenceManagerInView
|
||||
* PersistenceManager) on <code>getPersistenceManager()</code>, if any.
|
||||
* PersistenceManager) on {@code getPersistenceManager()}, if any.
|
||||
*
|
||||
* <p>Essentially, <code>getPersistenceManager()</code> calls get seamlessly
|
||||
* <p>Essentially, {@code getPersistenceManager()} calls get seamlessly
|
||||
* forwarded to {@link PersistenceManagerFactoryUtils#getPersistenceManager}.
|
||||
* Furthermore, <code>PersistenceManager.close</code> calls get forwarded to
|
||||
* Furthermore, {@code PersistenceManager.close} calls get forwarded to
|
||||
* {@link PersistenceManagerFactoryUtils#releasePersistenceManager}.
|
||||
*
|
||||
* <p>The main advantage of this proxy is that it allows DAOs to work with a
|
||||
@@ -104,8 +104,8 @@ public class TransactionAwarePersistenceManagerFactoryProxy implements FactoryBe
|
||||
* <p>Default is "true". Can be turned off to enforce access to
|
||||
* transactional PersistenceManagers, which safely allows for DAOs
|
||||
* written to get a PersistenceManager without explicit closing
|
||||
* (i.e. a <code>PersistenceManagerFactory.getPersistenceManager()</code>
|
||||
* call without corresponding <code>PersistenceManager.close()</code> call).
|
||||
* (i.e. a {@code PersistenceManagerFactory.getPersistenceManager()}
|
||||
* call without corresponding {@code PersistenceManager.close()} call).
|
||||
* @see PersistenceManagerFactoryUtils#getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
|
||||
*/
|
||||
public void setAllowCreate(boolean allowCreate) {
|
||||
|
||||
@@ -37,12 +37,12 @@ import org.springframework.orm.jdo.PersistenceManagerFactoryUtils;
|
||||
* <p>This base class is mainly intended for JdoTemplate usage but can also
|
||||
* be used when working with PersistenceManagerFactoryUtils directly, for example
|
||||
* in combination with JdoInterceptor-managed PersistenceManagers. Convenience
|
||||
* <code>getPersistenceManager</code> and <code>releasePersistenceManager</code>
|
||||
* {@code getPersistenceManager} and {@code releasePersistenceManager}
|
||||
* methods are provided for that usage style.
|
||||
*
|
||||
* <p>This class will create its own JdoTemplate if only a PersistenceManagerFactory
|
||||
* is passed in. The "allowCreate" flag on that JdoTemplate will be "true" by default.
|
||||
* A custom JdoTemplate instance can be used through overriding <code>createJdoTemplate</code>.
|
||||
* A custom JdoTemplate instance can be used through overriding {@code createJdoTemplate}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 28.07.2003
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
||||
* as for non-transactional read-only execution.
|
||||
*
|
||||
* <p>Looks up the PersistenceManagerFactory in Spring's root web application context.
|
||||
* Supports a "persistenceManagerFactoryBeanName" filter init-param in <code>web.xml</code>;
|
||||
* Supports a "persistenceManagerFactoryBeanName" filter init-param in {@code web.xml};
|
||||
* the default bean name is "persistenceManagerFactory". Looks up the PersistenceManagerFactory
|
||||
* on each request, to avoid initialization order issues (when using ContextLoaderServlet,
|
||||
* the root application context will get initialized <i>after</i> this filter).
|
||||
@@ -118,7 +118,7 @@ public class OpenPersistenceManagerInViewFilter extends OncePerRequestFilter {
|
||||
/**
|
||||
* Look up the PersistenceManagerFactory that this filter should use,
|
||||
* taking the current HTTP request as argument.
|
||||
* <p>Default implementation delegates to the <code>lookupPersistenceManagerFactory</code>
|
||||
* <p>Default implementation delegates to the {@code lookupPersistenceManagerFactory}
|
||||
* without arguments.
|
||||
* @return the PersistenceManagerFactory to use
|
||||
* @see #lookupPersistenceManagerFactory()
|
||||
|
||||
@@ -105,7 +105,7 @@ public class SpringPersistenceManagerProxyBean implements FactoryBean<Persistenc
|
||||
/**
|
||||
* Specify the PersistenceManager interface to expose,
|
||||
* possibly including vendor extensions.
|
||||
* <p>Default is the standard <code>javax.jdo.PersistenceManager</code> interface.
|
||||
* <p>Default is the standard {@code javax.jdo.PersistenceManager} interface.
|
||||
*/
|
||||
public void setPersistenceManagerInterface(Class<? extends PersistenceManager> persistenceManagerInterface) {
|
||||
this.persistenceManagerInterface = persistenceManagerInterface;
|
||||
@@ -127,8 +127,8 @@ public class SpringPersistenceManagerProxyBean implements FactoryBean<Persistenc
|
||||
* <p>Default is "true". Can be turned off to enforce access to
|
||||
* transactional PersistenceManagers, which safely allows for DAOs
|
||||
* written to get a PersistenceManager without explicit closing
|
||||
* (i.e. a <code>PersistenceManagerFactory.getPersistenceManager()</code>
|
||||
* call without corresponding <code>PersistenceManager.close()</code> call).
|
||||
* (i.e. a {@code PersistenceManagerFactory.getPersistenceManager()}
|
||||
* call without corresponding {@code PersistenceManager.close()} call).
|
||||
* @see org.springframework.orm.jdo.PersistenceManagerFactoryUtils#getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)
|
||||
*/
|
||||
public void setAllowCreate(boolean allowCreate) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Classes supporting the <code>org.springframework.orm.jdo</code> package.
|
||||
* Classes supporting the {@code org.springframework.orm.jdo} package.
|
||||
* Contains a DAO base class for JdoTemplate usage.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -163,7 +163,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
|
||||
/**
|
||||
* Specify JPA properties, to be passed into
|
||||
* <code>Persistence.createEntityManagerFactory</code> (if any).
|
||||
* {@code Persistence.createEntityManagerFactory} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor) or a
|
||||
* "props" element in XML bean definitions.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map)
|
||||
@@ -175,7 +175,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
|
||||
/**
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* <code>Persistence.createEntityManagerFactory</code> (if any).
|
||||
* {@code Persistence.createEntityManagerFactory} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
|
||||
@@ -200,7 +200,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* Specify the (potentially vendor-specific) EntityManagerFactory interface
|
||||
* that this EntityManagerFactory proxy is supposed to implement.
|
||||
* <p>The default will be taken from the specific JpaVendorAdapter, if any,
|
||||
* or set to the standard <code>javax.persistence.EntityManagerFactory</code>
|
||||
* or set to the standard {@code javax.persistence.EntityManagerFactory}
|
||||
* interface else.
|
||||
* @see JpaVendorAdapter#getEntityManagerFactoryInterface()
|
||||
*/
|
||||
@@ -213,7 +213,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* Specify the (potentially vendor-specific) EntityManager interface
|
||||
* that this factory's EntityManagers are supposed to implement.
|
||||
* <p>The default will be taken from the specific JpaVendorAdapter, if any,
|
||||
* or set to the standard <code>javax.persistence.EntityManager</code>
|
||||
* or set to the standard {@code javax.persistence.EntityManager}
|
||||
* interface else.
|
||||
* @see JpaVendorAdapter#getEntityManagerInterface()
|
||||
* @see EntityManagerFactoryInfo#getEntityManagerInterface()
|
||||
@@ -254,7 +254,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
|
||||
/**
|
||||
* Return the JpaVendorAdapter implementation for this
|
||||
* EntityManagerFactory, or <code>null</code> if not known.
|
||||
* EntityManagerFactory, or {@code null} if not known.
|
||||
*/
|
||||
public JpaVendorAdapter getJpaVendorAdapter() {
|
||||
return this.jpaVendorAdapter;
|
||||
@@ -383,7 +383,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
|
||||
/**
|
||||
* Subclasses must implement this method to create the EntityManagerFactory
|
||||
* that will be returned by the <code>getObject()</code> method.
|
||||
* that will be returned by the {@code getObject()} method.
|
||||
* @return EntityManagerFactory instance returned by this FactoryBean
|
||||
* @throws PersistenceException if the EntityManager cannot be created
|
||||
*/
|
||||
|
||||
@@ -48,12 +48,12 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This implementation invokes the standard JPA <code>Transaction.begin</code>
|
||||
* This implementation invokes the standard JPA {@code Transaction.begin}
|
||||
* method. Throws an InvalidIsolationLevelException if a non-default isolation
|
||||
* level is set.
|
||||
* <p>This implementation does not return any transaction data Object, since there
|
||||
* is no state to be kept for a standard JPA transaction. Hence, subclasses do not
|
||||
* have to care about the return value (<code>null</code>) of this implementation
|
||||
* have to care about the return value ({@code null}) of this implementation
|
||||
* and are free to return their own transaction data Object.
|
||||
* @see javax.persistence.EntityTransaction#begin
|
||||
* @see org.springframework.transaction.InvalidIsolationLevelException
|
||||
@@ -78,7 +78,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation does nothing, since the default <code>beginTransaction</code>
|
||||
* This implementation does nothing, since the default {@code beginTransaction}
|
||||
* implementation does not require any cleanup.
|
||||
* @see #beginTransaction
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation always returns <code>null</code>,
|
||||
* This implementation always returns {@code null},
|
||||
* indicating that no JDBC Connection can be provided.
|
||||
*/
|
||||
public ConnectionHandle getJdbcConnection(EntityManager entityManager, boolean readOnly)
|
||||
@@ -100,7 +100,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* will implicitly be closed with the EntityManager.
|
||||
* <p>If the JPA implementation returns a Connection handle that it expects
|
||||
* the application to close after use, the dialect implementation needs to invoke
|
||||
* <code>Connection.close()</code> (or some other method with similar effect) here.
|
||||
* {@code Connection.close()} (or some other method with similar effect) here.
|
||||
* @see java.sql.Connection#close()
|
||||
*/
|
||||
public void releaseJdbcConnection(ConnectionHandle conHandle, EntityManager em)
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
|
||||
/**
|
||||
* Specify JPA properties, to be passed into
|
||||
* <code>EntityManagerFactory.createEntityManager(Map)</code> (if any).
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor)
|
||||
* or a "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
@@ -105,7 +105,7 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
|
||||
/**
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* <code>EntityManagerFactory.createEntityManager(Map)</code> (if any).
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
@@ -158,7 +158,7 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
|
||||
/**
|
||||
* Obtain the transactional EntityManager for this accessor's EntityManagerFactory, if any.
|
||||
* @return the transactional EntityManager, or <code>null</code> if none
|
||||
* @return the transactional EntityManager, or {@code null} if none
|
||||
* @throws IllegalStateException if this accessor is not configured with an EntityManagerFactory
|
||||
* @see EntityManagerFactoryUtils#getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
|
||||
* @see EntityManagerFactoryUtils#getTransactionalEntityManager(javax.persistence.EntityManagerFactory, java.util.Map)
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface EntityManagerFactoryInfo {
|
||||
|
||||
/**
|
||||
* Return the raw underlying EntityManagerFactory.
|
||||
* @return the unadorned EntityManagerFactory (never <code>null</code>)
|
||||
* @return the unadorned EntityManagerFactory (never {@code null})
|
||||
*/
|
||||
EntityManagerFactory getNativeEntityManagerFactory();
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface EntityManagerFactoryInfo {
|
||||
* Return the underlying PersistenceProvider that the underlying
|
||||
* EntityManagerFactory was created with.
|
||||
* @return the PersistenceProvider used to create this EntityManagerFactory,
|
||||
* or <code>null</code> if the standard JPA provider autodetection process
|
||||
* or {@code null} if the standard JPA provider autodetection process
|
||||
* was used to configure the EntityManagerFactory
|
||||
*/
|
||||
PersistenceProvider getPersistenceProvider();
|
||||
@@ -53,17 +53,17 @@ public interface EntityManagerFactoryInfo {
|
||||
* Return the PersistenceUnitInfo used to create this
|
||||
* EntityManagerFactory, if the in-container API was used.
|
||||
* @return the PersistenceUnitInfo used to create this EntityManagerFactory,
|
||||
* or <code>null</code> if the in-container contract was not used to
|
||||
* or {@code null} if the in-container contract was not used to
|
||||
* configure the EntityManagerFactory
|
||||
*/
|
||||
PersistenceUnitInfo getPersistenceUnitInfo();
|
||||
|
||||
/**
|
||||
* Return the name of the persistence unit used to create this
|
||||
* EntityManagerFactory, or <code>null</code> if it is an unnamed default.
|
||||
* <p>If <code>getPersistenceUnitInfo()</code> returns non-null, the result of
|
||||
* <code>getPersistenceUnitName()</code> must be equal to the value returned by
|
||||
* <code>PersistenceUnitInfo.getPersistenceUnitName()</code>.
|
||||
* EntityManagerFactory, or {@code null} if it is an unnamed default.
|
||||
* <p>If {@code getPersistenceUnitInfo()} returns non-null, the result of
|
||||
* {@code getPersistenceUnitName()} must be equal to the value returned by
|
||||
* {@code PersistenceUnitInfo.getPersistenceUnitName()}.
|
||||
* @see #getPersistenceUnitInfo()
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()
|
||||
*/
|
||||
@@ -72,22 +72,22 @@ public interface EntityManagerFactoryInfo {
|
||||
/**
|
||||
* Return the JDBC DataSource that this EntityManagerFactory
|
||||
* obtains its JDBC Connections from.
|
||||
* @return the JDBC DataSource, or <code>null</code> if not known
|
||||
* @return the JDBC DataSource, or {@code null} if not known
|
||||
*/
|
||||
DataSource getDataSource();
|
||||
|
||||
/**
|
||||
* Return the (potentially vendor-specific) EntityManager interface
|
||||
* that this factory's EntityManagers will implement.
|
||||
* <p>A <code>null</code> return value suggests that autodetection is supposed
|
||||
* to happen: either based on a target <code>EntityManager</code> instance
|
||||
* or simply defaulting to <code>javax.persistence.EntityManager</code>.
|
||||
* <p>A {@code null} return value suggests that autodetection is supposed
|
||||
* to happen: either based on a target {@code EntityManager} instance
|
||||
* or simply defaulting to {@code javax.persistence.EntityManager}.
|
||||
*/
|
||||
Class<? extends EntityManager> getEntityManagerInterface();
|
||||
|
||||
/**
|
||||
* Return the vendor-specific JpaDialect implementation for this
|
||||
* EntityManagerFactory, or <code>null</code> if not known.
|
||||
* EntityManagerFactory, or {@code null} if not known.
|
||||
*/
|
||||
JpaDialect getJpaDialect();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* the persistence unit name will be matched against the Spring bean name,
|
||||
* assuming that the EntityManagerFactory bean names follow that convention.
|
||||
* @param beanFactory the ListableBeanFactory to search
|
||||
* @param unitName the name of the persistence unit (may be <code>null</code> or empty,
|
||||
* @param unitName the name of the persistence unit (may be {@code null} or empty,
|
||||
* in which case a single bean of type EntityManagerFactory will be searched for)
|
||||
* @return the EntityManagerFactory
|
||||
* @throws NoSuchBeanDefinitionException if there is no such EntityManagerFactory in the context
|
||||
@@ -116,9 +116,9 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* Obtain a JPA EntityManager from the given factory. Is aware of a
|
||||
* corresponding EntityManager bound to the current thread,
|
||||
* for example when using JpaTransactionManager.
|
||||
* <p>Note: Will return <code>null</code> if no thread-bound EntityManager found!
|
||||
* <p>Note: Will return {@code null} if no thread-bound EntityManager found!
|
||||
* @param emf EntityManagerFactory to create the EntityManager with
|
||||
* @return the EntityManager, or <code>null</code> if none found
|
||||
* @return the EntityManager, or {@code null} if none found
|
||||
* @throws DataAccessResourceFailureException if the EntityManager couldn't be obtained
|
||||
* @see JpaTransactionManager
|
||||
*/
|
||||
@@ -132,11 +132,11 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* Obtain a JPA EntityManager from the given factory. Is aware of a
|
||||
* corresponding EntityManager bound to the current thread,
|
||||
* for example when using JpaTransactionManager.
|
||||
* <p>Note: Will return <code>null</code> if no thread-bound EntityManager found!
|
||||
* <p>Note: Will return {@code null} if no thread-bound EntityManager found!
|
||||
* @param emf EntityManagerFactory to create the EntityManager with
|
||||
* @param properties the properties to be passed into the <code>createEntityManager</code>
|
||||
* call (may be <code>null</code>)
|
||||
* @return the EntityManager, or <code>null</code> if none found
|
||||
* @param properties the properties to be passed into the {@code createEntityManager}
|
||||
* call (may be {@code null})
|
||||
* @return the EntityManager, or {@code null} if none found
|
||||
* @throws DataAccessResourceFailureException if the EntityManager couldn't be obtained
|
||||
* @see JpaTransactionManager
|
||||
*/
|
||||
@@ -154,11 +154,11 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* Obtain a JPA EntityManager from the given factory. Is aware of a
|
||||
* corresponding EntityManager bound to the current thread,
|
||||
* for example when using JpaTransactionManager.
|
||||
* <p>Same as <code>getEntityManager</code>, but throwing the original PersistenceException.
|
||||
* <p>Same as {@code getEntityManager}, but throwing the original PersistenceException.
|
||||
* @param emf EntityManagerFactory to create the EntityManager with
|
||||
* @param properties the properties to be passed into the <code>createEntityManager</code>
|
||||
* call (may be <code>null</code>)
|
||||
* @return the EntityManager, or <code>null</code> if none found
|
||||
* @param properties the properties to be passed into the {@code createEntityManager}
|
||||
* call (may be {@code null})
|
||||
* @return the EntityManager, or {@code null} if none found
|
||||
* @throws javax.persistence.PersistenceException if the EntityManager couldn't be created
|
||||
* @see #getTransactionalEntityManager(javax.persistence.EntityManagerFactory)
|
||||
* @see JpaTransactionManager
|
||||
@@ -273,7 +273,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
|
||||
/**
|
||||
* Convert the given runtime exception to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy.
|
||||
* {@code org.springframework.dao} hierarchy.
|
||||
* Return null if no translation is appropriate: any other exception may
|
||||
* have resulted from user code, and should not be translated.
|
||||
* <p>The most important cases like object not found or optimistic locking failure
|
||||
@@ -281,7 +281,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
* support sophisticated translation of exceptions via a JpaDialect.
|
||||
* @param ex runtime exception that occurred
|
||||
* @return the corresponding DataAccessException instance,
|
||||
* or <code>null</code> if the exception should not be translated
|
||||
* or {@code null} if the exception should not be translated
|
||||
*/
|
||||
public static DataAccessException convertJpaAccessExceptionIfPossible(RuntimeException ex) {
|
||||
// Following the JPA specification, a persistence provider can also
|
||||
@@ -327,7 +327,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
/**
|
||||
* Close the given JPA EntityManager,
|
||||
* catching and logging any cleanup exceptions thrown.
|
||||
* @param em the JPA EntityManager to close (may be <code>null</code>)
|
||||
* @param em the JPA EntityManager to close (may be {@code null})
|
||||
* @see javax.persistence.EntityManager#close()
|
||||
*/
|
||||
public static void closeEntityManager(EntityManager em) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface EntityManagerProxy extends EntityManager {
|
||||
* <p>In case of a shared ("transactional") EntityManager, this will be
|
||||
* the raw EntityManager that is currently associated with the transaction.
|
||||
* Outside of a transaction, an IllegalStateException will be thrown.
|
||||
* @return the underlying raw EntityManager (never <code>null</code>)
|
||||
* @return the underlying raw EntityManager (never {@code null})
|
||||
* @throws IllegalStateException if no underlying EntityManager is available
|
||||
*/
|
||||
EntityManager getTargetEntityManager() throws IllegalStateException;
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.springframework.util.CollectionUtils;
|
||||
* semantics for "extended" EntityManagers.
|
||||
*
|
||||
* <p>Supports explicit joining of a transaction through the
|
||||
* <code>joinTransaction()</code> method ("application-managed extended
|
||||
* {@code joinTransaction()} method ("application-managed extended
|
||||
* EntityManager") as well as automatic joining on each operation
|
||||
* ("container-managed extended EntityManager").
|
||||
*
|
||||
@@ -60,11 +60,11 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
|
||||
/**
|
||||
* Create an EntityManager that can join transactions with the
|
||||
* <code>joinTransaction()</code> method, but is not automatically
|
||||
* {@code joinTransaction()} method, but is not automatically
|
||||
* managed by the container.
|
||||
* @param rawEntityManager raw EntityManager
|
||||
* @param plusOperations an implementation of the EntityManagerPlusOperations
|
||||
* interface, if those operations should be exposed (may be <code>null</code>)
|
||||
* interface, if those operations should be exposed (may be {@code null})
|
||||
* @return an application-managed EntityManager that can join transactions
|
||||
* but does not participate in them automatically
|
||||
*/
|
||||
@@ -76,14 +76,14 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
|
||||
/**
|
||||
* Create an EntityManager that can join transactions with the
|
||||
* <code>joinTransaction()</code> method, but is not automatically
|
||||
* {@code joinTransaction()} method, but is not automatically
|
||||
* managed by the container.
|
||||
* @param rawEntityManager raw EntityManager
|
||||
* @param plusOperations an implementation of the EntityManagerPlusOperations
|
||||
* interface, if those operations should be exposed (may be <code>null</code>)
|
||||
* interface, if those operations should be exposed (may be {@code null})
|
||||
* @param exceptionTranslator the exception translator to use for translating
|
||||
* JPA commit/rollback exceptions during transaction synchronization
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @return an application-managed EntityManager that can join transactions
|
||||
* but does not participate in them automatically
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
|
||||
/**
|
||||
* Create an EntityManager that can join transactions with the
|
||||
* <code>joinTransaction()</code> method, but is not automatically
|
||||
* {@code joinTransaction()} method, but is not automatically
|
||||
* managed by the container.
|
||||
* @param rawEntityManager raw EntityManager
|
||||
* @param emfInfo the EntityManagerFactoryInfo to obtain the
|
||||
@@ -116,7 +116,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* operation in a transaction.
|
||||
* @param rawEntityManager raw EntityManager
|
||||
* @param plusOperations an implementation of the EntityManagerPlusOperations
|
||||
* interface, if those operations should be exposed (may be <code>null</code>)
|
||||
* interface, if those operations should be exposed (may be {@code null})
|
||||
* @return a container-managed EntityManager that will automatically participate
|
||||
* in any managed transaction
|
||||
*/
|
||||
@@ -131,10 +131,10 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* operation in a transaction.
|
||||
* @param rawEntityManager raw EntityManager
|
||||
* @param plusOperations an implementation of the EntityManagerPlusOperations
|
||||
* interface, if those operations should be exposed (may be <code>null</code>)
|
||||
* interface, if those operations should be exposed (may be {@code null})
|
||||
* @param exceptionTranslator the exception translator to use for translating
|
||||
* JPA commit/rollback exceptions during transaction synchronization
|
||||
* (may be <code>null</code>)
|
||||
* (may be {@code null})
|
||||
* @return a container-managed EntityManager that will automatically participate
|
||||
* in any managed transaction
|
||||
*/
|
||||
@@ -183,8 +183,8 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* If this implements the EntityManagerFactoryInfo interface, appropriate handling
|
||||
* of the native EntityManagerFactory and available EntityManagerPlusOperations
|
||||
* will automatically apply.
|
||||
* @param properties the properties to be passed into the <code>createEntityManager</code>
|
||||
* call (may be <code>null</code>)
|
||||
* @param properties the properties to be passed into the {@code createEntityManager}
|
||||
* call (may be {@code null})
|
||||
* @return a container-managed EntityManager that will automatically participate
|
||||
* in any managed transaction
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
@@ -234,12 +234,12 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
* Actually create the EntityManager proxy.
|
||||
* @param rawEm raw EntityManager
|
||||
* @param emIfc the (potentially vendor-specific) EntityManager
|
||||
* interface to proxy, or <code>null</code> for default detection of all interfaces
|
||||
* interface to proxy, or {@code null} for default detection of all interfaces
|
||||
* @param plusOperations an implementation of the EntityManagerPlusOperations
|
||||
* interface, if those operations should be exposed (may be <code>null</code>)
|
||||
* interface, if those operations should be exposed (may be {@code null})
|
||||
* @param exceptionTranslator the PersistenceException translator to use
|
||||
* @param jta whether to create a JTA-aware EntityManager
|
||||
* (or <code>null</code> if not known in advance)
|
||||
* (or {@code null} if not known in advance)
|
||||
* @param containerManaged whether to follow container-managed EntityManager
|
||||
* or application-managed EntityManager semantics
|
||||
* @return the EntityManager proxy
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.dao.support.DataAccessUtils;
|
||||
* @see JpaInterceptor
|
||||
* @see JpaDialect
|
||||
* @deprecated as of Spring 3.1, in favor of native EntityManager usage
|
||||
* (typically obtained through <code>@PersistenceContext</code>)
|
||||
* (typically obtained through {@code @PersistenceContext})
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class JpaAccessor extends EntityManagerFactoryAccessor implements InitializingBean {
|
||||
@@ -141,7 +141,7 @@ public abstract class JpaAccessor extends EntityManagerFactoryAccessor implement
|
||||
|
||||
/**
|
||||
* Convert the given runtime exception to an appropriate exception from the
|
||||
* <code>org.springframework.dao</code> hierarchy if necessary, or
|
||||
* {@code org.springframework.dao} hierarchy if necessary, or
|
||||
* return the exception itself if it is not persistence related
|
||||
* <p>Default implementation delegates to the JpaDialect.
|
||||
* May be overridden in subclasses.
|
||||
|
||||
@@ -22,23 +22,23 @@ import javax.persistence.PersistenceException;
|
||||
/**
|
||||
* Callback interface for JPA code. To be used with {@link JpaTemplate}'s
|
||||
* execution method, often as anonymous classes within a method implementation.
|
||||
* A typical implementation will call <code>EntityManager.find/merge</code>
|
||||
* A typical implementation will call {@code EntityManager.find/merge}
|
||||
* to perform some operations on persistent objects.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
* @see org.springframework.orm.jpa.JpaTemplate
|
||||
* @see org.springframework.orm.jpa.JpaTransactionManager
|
||||
* @see JpaTemplate
|
||||
* @see JpaTransactionManager
|
||||
* @deprecated as of Spring 3.1, in favor of native EntityManager usage
|
||||
* (typically obtained through <code>@PersistenceContext</code>)
|
||||
* (typically obtained through {@code @PersistenceContext})
|
||||
*/
|
||||
@Deprecated
|
||||
public interface JpaCallback<T> {
|
||||
|
||||
/**
|
||||
* Gets called by <code>JpaTemplate.execute</code> with an active
|
||||
* JPA <code>EntityManager</code>. Does not need to care about activating
|
||||
* or closing the <code>EntityManager</code>, or handling transactions.
|
||||
* Gets called by {@code JpaTemplate.execute} with an active
|
||||
* JPA {@code EntityManager}. Does not need to care about activating
|
||||
* or closing the {@code EntityManager}, or handling transactions.
|
||||
*
|
||||
* <p>Note that JPA callback code will not flush any modifications to the
|
||||
* database if not executed within a transaction. Thus, you need to make
|
||||
@@ -51,10 +51,10 @@ public interface JpaCallback<T> {
|
||||
* It gets propagated to the caller of the template.
|
||||
*
|
||||
* @param em active EntityManager
|
||||
* @return a result object, or <code>null</code> if none
|
||||
* @return a result object, or {@code null} if none
|
||||
* @throws PersistenceException if thrown by the JPA API
|
||||
* @see org.springframework.orm.jpa.JpaTemplate#execute
|
||||
* @see org.springframework.orm.jpa.JpaTemplate#executeFind
|
||||
* @see JpaTemplate#execute
|
||||
* @see JpaTemplate#executeFind
|
||||
*/
|
||||
T doInJpa(EntityManager em) throws PersistenceException;
|
||||
|
||||
|
||||
@@ -104,11 +104,11 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* given Spring transaction definition (in particular, an isolation level
|
||||
* and a timeout). Called by JpaTransactionManager on transaction begin.
|
||||
* <p>An implementation can configure the JPA Transaction object and then
|
||||
* invoke <code>begin</code>, or invoke a special begin method that takes,
|
||||
* invoke {@code begin}, or invoke a special begin method that takes,
|
||||
* for example, an isolation level.
|
||||
* <p>An implementation can apply the read-only flag as flush mode. In that case,
|
||||
* a transaction data object can be returned that holds the previous flush mode
|
||||
* (and possibly other data), to be reset in <code>cleanupTransaction</code>.
|
||||
* (and possibly other data), to be reset in {@code cleanupTransaction}.
|
||||
* It may also apply the read-only flag and isolation level to the underlying
|
||||
* JDBC Connection before beginning the transaction.
|
||||
* <p>Implementations can also use the Spring transaction name, as exposed by the
|
||||
@@ -138,7 +138,7 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* EntityManagerFactoryUtils when enlisting an EntityManager in a JTA transaction.
|
||||
* <p>An implementation can apply the read-only flag as flush mode. In that case,
|
||||
* a transaction data object can be returned that holds the previous flush mode
|
||||
* (and possibly other data), to be reset in <code>cleanupTransaction</code>.
|
||||
* (and possibly other data), to be reset in {@code cleanupTransaction}.
|
||||
* <p>Implementations can also use the Spring transaction name, as exposed by the
|
||||
* passed-in TransactionDefinition, to optimize for specific data access use cases
|
||||
* (effectively using the current transaction name as use case identifier).
|
||||
@@ -171,7 +171,7 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* if accessing a relational database. This method will just get invoked if actually
|
||||
* needing access to the underlying JDBC Connection, usually within an active JPA
|
||||
* transaction (for example, by JpaTransactionManager). The returned handle will
|
||||
* be passed into the <code>releaseJdbcConnection</code> method when not needed anymore.
|
||||
* be passed into the {@code releaseJdbcConnection} method when not needed anymore.
|
||||
* <p>This strategy is necessary as JPA 1.0 does not provide a standard way to retrieve
|
||||
* the underlying JDBC Connection (due to the fact that a JPA implementation might not
|
||||
* work with a relational database at all).
|
||||
@@ -183,12 +183,12 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
* <p>In a simple case where the returned Connection will be auto-closed with the
|
||||
* EntityManager or can be released via the Connection object itself, an
|
||||
* implementation can return a SimpleConnectionHandle that just contains the
|
||||
* Connection. If some other object is needed in <code>releaseJdbcConnection</code>,
|
||||
* Connection. If some other object is needed in {@code releaseJdbcConnection},
|
||||
* an implementation should use a special handle that references that other object.
|
||||
* @param entityManager the current JPA EntityManager
|
||||
* @param readOnly whether the Connection is only needed for read-only purposes
|
||||
* @return a handle for the JDBC Connection, to be passed into
|
||||
* <code>releaseJdbcConnection</code>, or <code>null</code>
|
||||
* {@code releaseJdbcConnection}, or {@code null}
|
||||
* if no JDBC Connection can be retrieved
|
||||
* @throws javax.persistence.PersistenceException if thrown by JPA methods
|
||||
* @throws java.sql.SQLException if thrown by JDBC methods
|
||||
@@ -203,10 +203,10 @@ public interface JpaDialect extends PersistenceExceptionTranslator {
|
||||
|
||||
/**
|
||||
* Release the given JDBC Connection, which has originally been retrieved
|
||||
* via <code>getJdbcConnection</code>. This should be invoked in any case,
|
||||
* via {@code getJdbcConnection}. This should be invoked in any case,
|
||||
* to allow for proper release of the retrieved Connection handle.
|
||||
* <p>An implementation might simply do nothing, if the Connection returned
|
||||
* by <code>getJdbcConnection</code> will be implicitly closed when the JPA
|
||||
* by {@code getJdbcConnection} will be implicitly closed when the JPA
|
||||
* transaction completes or when the EntityManager is closed.
|
||||
* @param conHandle the JDBC Connection handle to release
|
||||
* @param entityManager the current JPA EntityManager
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* or from a surrounding JPA-intercepted method), the interceptor simply participates in it.
|
||||
*
|
||||
* <p>Application code must retrieve a JPA EntityManager via the
|
||||
* <code>EntityManagerFactoryUtils.getEntityManager</code> method or - preferably -
|
||||
* via a shared <code>EntityManager</code> reference, to be able to detect a
|
||||
* {@code EntityManagerFactoryUtils.getEntityManager} method or - preferably -
|
||||
* via a shared {@code EntityManager} reference, to be able to detect a
|
||||
* thread-bound EntityManager. Typically, the code will look like as follows:
|
||||
*
|
||||
* <pre>
|
||||
@@ -40,9 +40,9 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* }</pre>
|
||||
*
|
||||
* <p>Note that this interceptor automatically translates PersistenceExceptions,
|
||||
* via delegating to the <code>EntityManagerFactoryUtils.convertJpaAccessException</code>
|
||||
* via delegating to the {@code EntityManagerFactoryUtils.convertJpaAccessException}
|
||||
* method that converts them to exceptions that are compatible with the
|
||||
* <code>org.springframework.dao</code> exception hierarchy (like JpaTemplate does).
|
||||
* {@code org.springframework.dao} exception hierarchy (like JpaTemplate does).
|
||||
*
|
||||
* <p>This class can be considered a declarative alternative to JpaTemplate's
|
||||
* callback approach. The advantages are:
|
||||
@@ -63,7 +63,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
* @see JpaTransactionManager
|
||||
* @see JpaTemplate
|
||||
* @deprecated as of Spring 3.1, in favor of native EntityManager usage
|
||||
* (typically obtained through <code>@PersistenceContext</code>) and
|
||||
* (typically obtained through {@code @PersistenceContext}) and
|
||||
* AOP-driven exception translation through
|
||||
* {@link org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor}
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ public class JpaInterceptor extends JpaAccessor implements MethodInterceptor {
|
||||
|
||||
/**
|
||||
* Set whether to convert any PersistenceException raised to a Spring DataAccessException,
|
||||
* compatible with the <code>org.springframework.dao</code> exception hierarchy.
|
||||
* compatible with the {@code org.springframework.dao} exception hierarchy.
|
||||
* <p>Default is "true". Turn this flag off to let the caller receive raw exceptions
|
||||
* as-is, without any wrapping.
|
||||
* @see org.springframework.dao.DataAccessException
|
||||
|
||||
@@ -26,17 +26,17 @@ import org.springframework.dao.DataAccessException;
|
||||
* implemented by {@link JpaTemplate}. Not often used, but a useful
|
||||
* option to enhance testability, as it can easily be mocked or stubbed.
|
||||
*
|
||||
* <p>Defines <code>JpaTemplate</code>'s data access methods that mirror
|
||||
* <p>Defines {@code JpaTemplate}'s data access methods that mirror
|
||||
* various {@link javax.persistence.EntityManager} methods. Users are
|
||||
* strongly encouraged to read the JPA <code>EntityManager</code>
|
||||
* strongly encouraged to read the JPA {@code EntityManager}
|
||||
* javadocs for details on the semantics of those methods.
|
||||
*
|
||||
* <p>Note that lazy loading will just work with an open JPA
|
||||
* <code>EntityManager</code>, either within a managed transaction or within
|
||||
* {@code EntityManager}, either within a managed transaction or within
|
||||
* {@link org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter}/
|
||||
* {@link org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor}.
|
||||
* Furthermore, some operations just make sense within transactions,
|
||||
* for example: <code>flush</code>, <code>clear</code>.
|
||||
* for example: {@code flush}, {@code clear}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
@@ -47,7 +47,7 @@ import org.springframework.dao.DataAccessException;
|
||||
* @see org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
|
||||
* @see org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor
|
||||
* @deprecated as of Spring 3.1, in favor of native EntityManager usage
|
||||
* (typically obtained through <code>@PersistenceContext</code>).
|
||||
* (typically obtained through {@code @PersistenceContext}).
|
||||
* Note that this interface did not get upgraded to JPA 2.0 and never will.
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.dao.UncategorizedDataAccessException;
|
||||
/**
|
||||
* JPA-specific subclass of UncategorizedDataAccessException,
|
||||
* for JPA system errors that do not match any concrete
|
||||
* <code>org.springframework.dao</code> exceptions.
|
||||
* {@code org.springframework.dao} exceptions.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||
* Helper class that allows for writing JPA data access code in the same style
|
||||
* as with Spring's well-known JdoTemplate and HibernateTemplate classes.
|
||||
* Automatically converts PersistenceExceptions into Spring DataAccessExceptions,
|
||||
* following the <code>org.springframework.dao</code> exception hierarchy.
|
||||
* following the {@code org.springframework.dao} exception hierarchy.
|
||||
*
|
||||
* <p>The central method is of this template is "execute", supporting JPA access code
|
||||
* implementing the {@link JpaCallback} interface. It provides JPA EntityManager
|
||||
@@ -86,7 +86,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
|
||||
* @see org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor
|
||||
* @deprecated as of Spring 3.1, in favor of native EntityManager usage
|
||||
* (typically obtained through <code>@PersistenceContext</code>)
|
||||
* (typically obtained through {@code @PersistenceContext})
|
||||
* Note that this class did not get upgraded to JPA 2.0 and never will.
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -123,7 +123,7 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
/**
|
||||
* Set whether to expose the native JPA EntityManager to JpaCallback
|
||||
* code. Default is "false": a EntityManager proxy will be returned,
|
||||
* suppressing <code>close</code> calls and automatically applying transaction
|
||||
* suppressing {@code close} calls and automatically applying transaction
|
||||
* timeouts (if any).
|
||||
* <p>As there is often a need to cast to a provider-specific EntityManager
|
||||
* class in DAOs that use the JPA 1.0 API, for JPA 2.0 previews and other
|
||||
@@ -165,7 +165,7 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
* @param action callback object that specifies the JPA action
|
||||
* @param exposeNativeEntityManager whether to expose the native
|
||||
* JPA entity manager to callback code
|
||||
* @return a result object returned by the action, or <code>null</code>
|
||||
* @return a result object returned by the action, or {@code null}
|
||||
* @throws org.springframework.dao.DataAccessException in case of JPA errors
|
||||
*/
|
||||
public <T> T execute(JpaCallback<T> action, boolean exposeNativeEntityManager) throws DataAccessException {
|
||||
|
||||
@@ -181,7 +181,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
/**
|
||||
* Specify JPA properties, to be passed into
|
||||
* <code>EntityManagerFactory.createEntityManager(Map)</code> (if any).
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a String "value" (parsed via PropertiesEditor)
|
||||
* or a "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
@@ -192,7 +192,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
/**
|
||||
* Specify JPA properties as a Map, to be passed into
|
||||
* <code>EntityManagerFactory.createEntityManager(Map)</code> (if any).
|
||||
* {@code EntityManagerFactory.createEntityManager(Map)} (if any).
|
||||
* <p>Can be populated with a "map" or "props" element in XML bean definitions.
|
||||
* @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map)
|
||||
*/
|
||||
@@ -698,7 +698,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
/**
|
||||
* Holder for suspended resources.
|
||||
* Used internally by <code>doSuspend</code> and <code>doResume</code>.
|
||||
* Used internally by {@code doSuspend} and {@code doResume}.
|
||||
*/
|
||||
private static class SuspendedResourcesHolder {
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface JpaVendorAdapter {
|
||||
* the EntityManagerFactory bean, which might potentially override
|
||||
* individual JPA property values specified here.
|
||||
* @return a Map of JPA properties, as as accepted by the standard
|
||||
* JPA bootstrap facilities, or <code>null</code> or an empty Map
|
||||
* JPA bootstrap facilities, or {@code null} or an empty Map
|
||||
* if there are no such properties to expose
|
||||
* @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map)
|
||||
* @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map)
|
||||
@@ -63,7 +63,7 @@ public interface JpaVendorAdapter {
|
||||
|
||||
/**
|
||||
* Return the vendor-specific JpaDialect implementation for this
|
||||
* provider, or <code>null</code> if there is none.
|
||||
* provider, or {@code null} if there is none.
|
||||
*/
|
||||
JpaDialect getJpaDialect();
|
||||
|
||||
|
||||
@@ -41,19 +41,19 @@ import org.springframework.util.ClassUtils;
|
||||
* up a shared JPA EntityManagerFactory in a Spring application context;
|
||||
* the EntityManagerFactory can then be passed to JPA-based DAOs via
|
||||
* dependency injection. Note that switching to a JNDI lookup or to a
|
||||
* {@link org.springframework.orm.jpa.LocalEntityManagerFactoryBean}
|
||||
* {@link LocalEntityManagerFactoryBean}
|
||||
* definition is just a matter of configuration!
|
||||
*
|
||||
* <p>As with {@link LocalEntityManagerFactoryBean}, configuration settings
|
||||
* are usually read in from a <code>META-INF/persistence.xml</code> config file,
|
||||
* are usually read in from a {@code META-INF/persistence.xml} config file,
|
||||
* residing in the class path, according to the general JPA configuration contract.
|
||||
* However, this FactoryBean is more flexible in that you can override the location
|
||||
* of the <code>persistence.xml</code> file, specify the JDBC DataSources to link to,
|
||||
* of the {@code persistence.xml} file, specify the JDBC DataSources to link to,
|
||||
* etc. Furthermore, it allows for pluggable class instrumentation through Spring's
|
||||
* {@link org.springframework.instrument.classloading.LoadTimeWeaver} abstraction,
|
||||
* instead of being tied to a special VM agent specified on JVM startup.
|
||||
*
|
||||
* <p>Internally, this FactoryBean parses the <code>persistence.xml</code> file
|
||||
* <p>Internally, this FactoryBean parses the {@code persistence.xml} file
|
||||
* itself and creates a corresponding {@link javax.persistence.spi.PersistenceUnitInfo}
|
||||
* object (with further configuration merged in, such as JDBC DataSources and the
|
||||
* Spring LoadTimeWeaver), to be passed to the chosen JPA
|
||||
@@ -97,7 +97,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* <p>For reuse of existing persistence unit configuration or more advanced forms
|
||||
* of custom persistence unit handling, consider defining a separate
|
||||
* PersistenceUnitManager bean (typically a DefaultPersistenceUnitManager instance)
|
||||
* and linking it in here. <code>persistence.xml</code> location, DataSource
|
||||
* and linking it in here. {@code persistence.xml} location, DataSource
|
||||
* configuration and LoadTimeWeaver will be defined on that separate
|
||||
* DefaultPersistenceUnitManager bean in such a scenario.
|
||||
* @see #setPersistenceXmlLocation
|
||||
@@ -110,12 +110,12 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the location of the <code>persistence.xml</code> file
|
||||
* Set the location of the {@code persistence.xml} file
|
||||
* we want to use. This is a Spring resource location.
|
||||
* <p>Default is "classpath:META-INF/persistence.xml".
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @param persistenceXmlLocation a Spring resource String
|
||||
* identifying the location of the <code>persistence.xml</code> file
|
||||
* identifying the location of the {@code persistence.xml} file
|
||||
* that this LocalContainerEntityManagerFactoryBean should parse
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
@@ -136,8 +136,8 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
|
||||
/**
|
||||
* Set whether to use Spring-based scanning for entity classes in the classpath
|
||||
* instead of using JPA's standard scanning of jar files with <code>persistence.xml</code>
|
||||
* markers in them. In case of Spring-based scanning, no <code>persistence.xml</code>
|
||||
* instead of using JPA's standard scanning of jar files with {@code persistence.xml}
|
||||
* markers in them. In case of Spring-based scanning, no {@code persistence.xml}
|
||||
* is necessary; all you need to do is to specify base packages to search here.
|
||||
* <p>Default is none. Specify packages to search for autodetection of your entity
|
||||
* classes in the classpath. This is analogous to Spring's component-scan feature
|
||||
@@ -152,13 +152,13 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify one or more mapping resources (equivalent to <code><mapping-file></code>
|
||||
* entries in <code>persistence.xml</code>) for the default persistence unit.
|
||||
* Specify one or more mapping resources (equivalent to {@code <mapping-file>}
|
||||
* entries in {@code persistence.xml}) for the default persistence unit.
|
||||
* Can be used on its own or in combination with entity scanning in the classpath,
|
||||
* in both cases avoiding <code>persistence.xml</code>.
|
||||
* in both cases avoiding {@code persistence.xml}.
|
||||
* <p>Note that mapping resources must be relative to the classpath root,
|
||||
* e.g. "META-INF/mappings.xml" or "com/mycompany/repository/mappings.xml",
|
||||
* so that they can be loaded through <code>ClassLoader.getResource</code>.
|
||||
* so that they can be loaded through {@code ClassLoader.getResource}.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
@@ -169,11 +169,11 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
/**
|
||||
* Specify the JDBC DataSource that the JPA persistence provider is supposed
|
||||
* to use for accessing the database. This is an alternative to keeping the
|
||||
* JDBC configuration in <code>persistence.xml</code>, passing in a Spring-managed
|
||||
* JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
|
||||
* DataSource instead.
|
||||
* <p>In JPA speak, a DataSource passed in here will be used as "nonJtaDataSource"
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
|
||||
* overriding data source configuration in <code>persistence.xml</code> (if any).
|
||||
* overriding data source configuration in {@code persistence.xml} (if any).
|
||||
* Note that this variant typically works for JTA transaction management as well;
|
||||
* if it does not, consider using the explicit {@link #setJtaDataSource} instead.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
@@ -188,11 +188,11 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
/**
|
||||
* Specify the JDBC DataSource that the JPA persistence provider is supposed
|
||||
* to use for accessing the database. This is an alternative to keeping the
|
||||
* JDBC configuration in <code>persistence.xml</code>, passing in a Spring-managed
|
||||
* JDBC configuration in {@code persistence.xml}, passing in a Spring-managed
|
||||
* DataSource instead.
|
||||
* <p>In JPA speak, a DataSource passed in here will be used as "jtaDataSource"
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, as well as
|
||||
* overriding data source configuration in <code>persistence.xml</code> (if any).
|
||||
* overriding data source configuration in {@code persistence.xml} (if any).
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
|
||||
* @see #setPersistenceUnitManager
|
||||
@@ -207,7 +207,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* PersistenceUnitInfo used for creating this EntityManagerFactory.
|
||||
* <p>Such post-processors can, for example, register further entity
|
||||
* classes and jar files, in addition to the metadata read from
|
||||
* <code>persistence.xml</code>.
|
||||
* {@code persistence.xml}.
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* @see #setPersistenceUnitManager
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* <p><b>NOTE:</b> As of Spring 2.5, the context's default LoadTimeWeaver (defined
|
||||
* as bean with name "loadTimeWeaver") will be picked up automatically, if available,
|
||||
* removing the need for LoadTimeWeaver configuration on each affected target bean.</b>
|
||||
* Consider using the <code>context:load-time-weaver</code> XML tag for creating
|
||||
* Consider using the {@code context:load-time-weaver} XML tag for creating
|
||||
* such a shared LoadTimeWeaver (autodetecting the environment by default).
|
||||
* <p><b>NOTE: Only applied if no external PersistenceUnitManager specified.</b>
|
||||
* Otherwise, the external {@link #setPersistenceUnitManager PersistenceUnitManager}
|
||||
@@ -295,7 +295,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* Determine the PersistenceUnitInfo to use for the EntityManagerFactory
|
||||
* created by this bean.
|
||||
* <p>The default implementation reads in all persistence unit infos from
|
||||
* <code>persistence.xml</code>, as defined in the JPA specification.
|
||||
* {@code persistence.xml}, as defined in the JPA specification.
|
||||
* If no entity manager name was specified, it takes the first info in the
|
||||
* array as returned by the reader. Otherwise, it checks for a matching name.
|
||||
* @param persistenceUnitManager the PersistenceUnitManager to obtain from
|
||||
|
||||
@@ -28,10 +28,10 @@ import javax.persistence.spi.PersistenceProvider;
|
||||
* shared JPA EntityManagerFactory in a Spring application context; the
|
||||
* EntityManagerFactory can then be passed to JPA-based DAOs via
|
||||
* dependency injection. Note that switching to a JNDI lookup or to a
|
||||
* {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean}
|
||||
* {@link LocalContainerEntityManagerFactoryBean}
|
||||
* definition is just a matter of configuration!
|
||||
*
|
||||
* <p>Configuration settings are usually read from a <code>META-INF/persistence.xml</code>
|
||||
* <p>Configuration settings are usually read from a {@code META-INF/persistence.xml}
|
||||
* config file, residing in the class path, according to the JPA standalone bootstrap
|
||||
* contract. Additionally, most JPA providers will require a special VM agent
|
||||
* (specified on JVM startup) that allows them to instrument application classes.
|
||||
|
||||
@@ -71,7 +71,7 @@ public abstract class SharedEntityManagerCreator {
|
||||
* appropriate handling of the native EntityManagerFactory and available
|
||||
* {@link EntityManagerPlusOperations} will automatically apply.
|
||||
* @param properties the properties to be passed into the
|
||||
* <code>createEntityManager</code> call (may be <code>null</code>)
|
||||
* {@code createEntityManager} call (may be {@code null})
|
||||
* @return a shareable transaction EntityManager proxy
|
||||
*/
|
||||
public static EntityManager createSharedEntityManager(EntityManagerFactory emf, Map properties) {
|
||||
@@ -100,7 +100,7 @@ public abstract class SharedEntityManagerCreator {
|
||||
* Create a transactional EntityManager proxy for the given EntityManagerFactory.
|
||||
* @param emf EntityManagerFactory to obtain EntityManagers from as needed
|
||||
* @param properties the properties to be passed into the
|
||||
* <code>createEntityManager</code> call (may be <code>null</code>)
|
||||
* {@code createEntityManager} call (may be {@code null})
|
||||
* @param entityManagerInterfaces the interfaces to be implemented by the
|
||||
* EntityManager. Allows the addition or specification of proprietary interfaces.
|
||||
* @return a shareable transactional EntityManager proxy
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Simple adapter that implements the <code>java.lang.instrument.ClassFileTransformer</code>
|
||||
* Simple adapter that implements the {@code java.lang.instrument.ClassFileTransformer}
|
||||
* interface based on a JPA ClassTransformer which a JPA PersistenceProvider asks the
|
||||
* PersistenceUnitInfo to install in the current runtime.
|
||||
*
|
||||
|
||||
@@ -61,10 +61,10 @@ import org.springframework.util.ResourceUtils;
|
||||
* Used as internal default by
|
||||
* {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean}.
|
||||
*
|
||||
* <p>Supports standard JPA scanning for <code>persistence.xml</code> files,
|
||||
* <p>Supports standard JPA scanning for {@code persistence.xml} files,
|
||||
* with configurable file locations, JDBC DataSource lookup and load-time weaving.
|
||||
*
|
||||
* <p>The default XML file location is <code>classpath*:META-INF/persistence.xml</code>,
|
||||
* <p>The default XML file location is {@code classpath*:META-INF/persistence.xml},
|
||||
* scanning for all matching files in the class path (as defined in the JPA specification).
|
||||
* DataSource names are by default interpreted as JNDI names, and no load time weaving
|
||||
* is available (which requires weaving to be turned off in the persistence provider).
|
||||
@@ -80,7 +80,7 @@ public class DefaultPersistenceUnitManager
|
||||
implements PersistenceUnitManager, ResourceLoaderAware, LoadTimeWeaverAware, InitializingBean {
|
||||
|
||||
/**
|
||||
* Default location of the <code>persistence.xml</code> file:
|
||||
* Default location of the {@code persistence.xml} file:
|
||||
* "classpath*:META-INF/persistence.xml".
|
||||
*/
|
||||
public final static String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF/persistence.xml";
|
||||
@@ -131,7 +131,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
|
||||
/**
|
||||
* Specify the location of the <code>persistence.xml</code> files to load.
|
||||
* Specify the location of the {@code persistence.xml} files to load.
|
||||
* These can be specified as Spring resource locations and/or location patterns.
|
||||
* <p>Default is "classpath*:META-INF/persistence.xml".
|
||||
*/
|
||||
@@ -140,11 +140,11 @@ public class DefaultPersistenceUnitManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify multiple locations of <code>persistence.xml</code> files to load.
|
||||
* Specify multiple locations of {@code persistence.xml} files to load.
|
||||
* These can be specified as Spring resource locations and/or location patterns.
|
||||
* <p>Default is "classpath*:META-INF/persistence.xml".
|
||||
* @param persistenceXmlLocations an array of Spring resource Strings
|
||||
* identifying the location of the <code>persistence.xml</code> files to read
|
||||
* identifying the location of the {@code persistence.xml} files to read
|
||||
*/
|
||||
public void setPersistenceXmlLocations(String... persistenceXmlLocations) {
|
||||
this.persistenceXmlLocations = persistenceXmlLocations;
|
||||
@@ -163,7 +163,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Specify the name of the default persistence unit, if any. Default is "default".
|
||||
* <p>Primarily applied to a scanned persistence unit without <code>persistence.xml</code>.
|
||||
* <p>Primarily applied to a scanned persistence unit without {@code persistence.xml}.
|
||||
* Also applicable to selecting a default unit from several persistence units available.
|
||||
* @see #setPackagesToScan
|
||||
* @see #obtainDefaultPersistenceUnitInfo
|
||||
@@ -174,8 +174,8 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Set whether to use Spring-based scanning for entity classes in the classpath
|
||||
* instead of using JPA's standard scanning of jar files with <code>persistence.xml</code>
|
||||
* markers in them. In case of Spring-based scanning, no <code>persistence.xml</code>
|
||||
* instead of using JPA's standard scanning of jar files with {@code persistence.xml}
|
||||
* markers in them. In case of Spring-based scanning, no {@code persistence.xml}
|
||||
* is necessary; all you need to do is to specify base packages to search here.
|
||||
* <p>Default is none. Specify packages to search for autodetection of your entity
|
||||
* classes in the classpath. This is analogous to Spring's component-scan feature
|
||||
@@ -186,13 +186,13 @@ public class DefaultPersistenceUnitManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify one or more mapping resources (equivalent to <code><mapping-file></code>
|
||||
* entries in <code>persistence.xml</code>) for the default persistence unit.
|
||||
* Specify one or more mapping resources (equivalent to {@code <mapping-file>}
|
||||
* entries in {@code persistence.xml}) for the default persistence unit.
|
||||
* Can be used on its own or in combination with entity scanning in the classpath,
|
||||
* in both cases avoiding <code>persistence.xml</code>.
|
||||
* in both cases avoiding {@code persistence.xml}.
|
||||
* <p>Note that mapping resources must be relative to the classpath root,
|
||||
* e.g. "META-INF/mappings.xml" or "com/mycompany/repository/mappings.xml",
|
||||
* so that they can be loaded through <code>ClassLoader.getResource</code>.
|
||||
* so that they can be loaded through {@code ClassLoader.getResource}.
|
||||
* @see #setPackagesToScan
|
||||
*/
|
||||
public void setMappingResources(String... mappingResources) {
|
||||
@@ -202,9 +202,9 @@ public class DefaultPersistenceUnitManager
|
||||
/**
|
||||
* Specify the JDBC DataSources that the JPA persistence provider is supposed
|
||||
* to use for accessing the database, resolving data source names in
|
||||
* <code>persistence.xml</code> against Spring-managed DataSources.
|
||||
* {@code persistence.xml} against Spring-managed DataSources.
|
||||
* <p>The specified Map needs to define data source names for specific DataSource
|
||||
* objects, matching the data source names used in <code>persistence.xml</code>.
|
||||
* objects, matching the data source names used in {@code persistence.xml}.
|
||||
* If not specified, data source names will be resolved as JNDI names instead
|
||||
* (as defined by standard JPA).
|
||||
* @see org.springframework.jdbc.datasource.lookup.MapDataSourceLookup
|
||||
@@ -215,13 +215,13 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Specify the JDBC DataSourceLookup that provides DataSources for the
|
||||
* persistence provider, resolving data source names in <code>persistence.xml</code>
|
||||
* persistence provider, resolving data source names in {@code persistence.xml}
|
||||
* against Spring-managed DataSource instances.
|
||||
* <p>Default is JndiDataSourceLookup, which resolves DataSource names as
|
||||
* JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup
|
||||
* instance if you want DataSource names to be resolved against Spring bean names.
|
||||
* <p>Alternatively, consider passing in a map from names to DataSource instances
|
||||
* via the "dataSources" property. If the <code>persistence.xml</code> file
|
||||
* via the "dataSources" property. If the {@code persistence.xml} file
|
||||
* does not define DataSource names at all, specify a default DataSource
|
||||
* via the "defaultDataSource" property.
|
||||
* @see org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup
|
||||
@@ -235,7 +235,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Return the JDBC DataSourceLookup that provides DataSources for the
|
||||
* persistence provider, resolving data source names in <code>persistence.xml</code>
|
||||
* persistence provider, resolving data source names in {@code persistence.xml}
|
||||
* against Spring-managed DataSource instances.
|
||||
*/
|
||||
public DataSourceLookup getDataSourceLookup() {
|
||||
@@ -244,7 +244,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Specify the JDBC DataSource that the JPA persistence provider is supposed to use
|
||||
* for accessing the database if none has been specified in <code>persistence.xml</code>.
|
||||
* for accessing the database if none has been specified in {@code persistence.xml}.
|
||||
* This variant indicates no special transaction setup, i.e. typical resource-local.
|
||||
* <p>In JPA speak, a DataSource passed in here will be uses as "nonJtaDataSource"
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, provided that
|
||||
@@ -257,7 +257,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Return the JDBC DataSource that the JPA persistence provider is supposed to use
|
||||
* for accessing the database if none has been specified in <code>persistence.xml</code>.
|
||||
* for accessing the database if none has been specified in {@code persistence.xml}.
|
||||
*/
|
||||
public DataSource getDefaultDataSource() {
|
||||
return this.defaultDataSource;
|
||||
@@ -265,7 +265,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Specify the JDBC DataSource that the JPA persistence provider is supposed to use
|
||||
* for accessing the database if none has been specified in <code>persistence.xml</code>.
|
||||
* for accessing the database if none has been specified in {@code persistence.xml}.
|
||||
* This variant indicates that JTA is supposed to be used as transaction type.
|
||||
* <p>In JPA speak, a DataSource passed in here will be uses as "jtaDataSource"
|
||||
* on the PersistenceUnitInfo passed to the PersistenceProvider, provided that
|
||||
@@ -278,7 +278,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Return the JTA-aware DataSource that the JPA persistence provider is supposed to use
|
||||
* for accessing the database if none has been specified in <code>persistence.xml</code>.
|
||||
* for accessing the database if none has been specified in {@code persistence.xml}.
|
||||
*/
|
||||
public DataSource getDefaultJtaDataSource() {
|
||||
return this.defaultJtaDataSource;
|
||||
@@ -288,7 +288,7 @@ public class DefaultPersistenceUnitManager
|
||||
* Set the PersistenceUnitPostProcessors to be applied to each
|
||||
* PersistenceUnitInfo that has been parsed by this manager.
|
||||
* <p>Such post-processors can, for example, register further entity classes and
|
||||
* jar files, in addition to the metadata read from <code>persistence.xml</code>.
|
||||
* jar files, in addition to the metadata read from {@code persistence.xml}.
|
||||
*/
|
||||
public void setPersistenceUnitPostProcessors(PersistenceUnitPostProcessor... postProcessors) {
|
||||
this.persistenceUnitPostProcessors = postProcessors;
|
||||
@@ -316,7 +316,7 @@ public class DefaultPersistenceUnitManager
|
||||
* <p><b>NOTE:</b> As of Spring 2.5, the context's default LoadTimeWeaver (defined
|
||||
* as bean with name "loadTimeWeaver") will be picked up automatically, if available,
|
||||
* removing the need for LoadTimeWeaver configuration on each affected target bean.</b>
|
||||
* Consider using the <code>context:load-time-weaver</code> XML tag for creating
|
||||
* Consider using the {@code context:load-time-weaver} XML tag for creating
|
||||
* such a shared LoadTimeWeaver (autodetecting the environment by default).
|
||||
* @see org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
|
||||
* @see org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
|
||||
@@ -348,7 +348,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Prepare the PersistenceUnitInfos according to the configuration
|
||||
* of this manager: scanning for <code>persistence.xml</code> files,
|
||||
* of this manager: scanning for {@code persistence.xml} files,
|
||||
* parsing all matching files, configuring and post-processing them.
|
||||
* <p>PersistenceUnitInfos cannot be obtained before this preparation
|
||||
* method has been invoked.
|
||||
@@ -394,7 +394,7 @@ public class DefaultPersistenceUnitManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Read all persistence unit infos from <code>persistence.xml</code>,
|
||||
* Read all persistence unit infos from {@code persistence.xml},
|
||||
* as defined in the JPA specification.
|
||||
*/
|
||||
private List<SpringPersistenceUnitInfo> readPersistenceUnitInfos() {
|
||||
@@ -499,7 +499,7 @@ public class DefaultPersistenceUnitManager
|
||||
* <p>This can be used in {@link #postProcessPersistenceUnitInfo} implementations,
|
||||
* detecting existing persistence units of the same name and potentially merging them.
|
||||
* @param persistenceUnitName the name of the desired persistence unit
|
||||
* @return the PersistenceUnitInfo in mutable form, or <code>null</code> if not available
|
||||
* @return the PersistenceUnitInfo in mutable form, or {@code null} if not available
|
||||
*/
|
||||
protected final MutablePersistenceUnitInfo getPersistenceUnitInfo(String persistenceUnitName) {
|
||||
PersistenceUnitInfo pui = this.persistenceUnitInfos.get(persistenceUnitName);
|
||||
@@ -519,7 +519,7 @@ public class DefaultPersistenceUnitManager
|
||||
* <p>The default implementation delegates to all registered PersistenceUnitPostProcessors.
|
||||
* It is usually preferable to register further entity classes, jar files etc there
|
||||
* rather than in a subclass of this manager, to be able to reuse the post-processors.
|
||||
* @param pui the chosen PersistenceUnitInfo, as read from <code>persistence.xml</code>.
|
||||
* @param pui the chosen PersistenceUnitInfo, as read from {@code persistence.xml}.
|
||||
* Passed in as MutablePersistenceUnitInfo.
|
||||
* @see #setPersistenceUnitPostProcessors
|
||||
*/
|
||||
@@ -534,7 +534,7 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Return whether an override of a same-named persistence unit is allowed.
|
||||
* <p>Default is <code>false</code>. May be overridden to return <code>true</code>,
|
||||
* <p>Default is {@code false}. May be overridden to return {@code true},
|
||||
* for example if {@link #postProcessPersistenceUnitInfo} is able to handle that case.
|
||||
*/
|
||||
protected boolean isPersistenceUnitOverrideAllowed() {
|
||||
@@ -577,8 +577,8 @@ public class DefaultPersistenceUnitManager
|
||||
|
||||
/**
|
||||
* Decorator that exposes a JPA 2.0 compliant PersistenceUnitInfo interface for a
|
||||
* JPA 1.0 based SpringPersistenceUnitInfo object, adapting the <code>getSharedCacheMode</code>
|
||||
* and <code>getValidationMode</code> methods from String names to enum return values.
|
||||
* JPA 1.0 based SpringPersistenceUnitInfo object, adapting the {@code getSharedCacheMode}
|
||||
* and {@code getValidationMode} methods from String names to enum return values.
|
||||
*/
|
||||
private static class Jpa2PersistenceUnitInfoDecorator implements InvocationHandler {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface PersistenceUnitManager {
|
||||
|
||||
/**
|
||||
* Obtain the default PersistenceUnitInfo from this manager.
|
||||
* @return the PersistenceUnitInfo (never <code>null</code>)
|
||||
* @return the PersistenceUnitInfo (never {@code null})
|
||||
* @throws IllegalStateException if there is no default PersistenceUnitInfo defined
|
||||
* or it has already been obtained
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public interface PersistenceUnitManager {
|
||||
/**
|
||||
* Obtain the specified PersistenceUnitInfo from this manager.
|
||||
* @param persistenceUnitName the name of the desired persistence unit
|
||||
* @return the PersistenceUnitInfo (never <code>null</code>)
|
||||
* @return the PersistenceUnitInfo (never {@code null})
|
||||
* @throws IllegalArgumentException if no PersistenceUnitInfo with the given
|
||||
* name is defined
|
||||
* @throws IllegalStateException if the PersistenceUnitInfo with the given
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface PersistenceUnitPostProcessor {
|
||||
/**
|
||||
* Post-process the given PersistenceUnitInfo, for example registering
|
||||
* further entity classes and jar files.
|
||||
* @param pui the chosen PersistenceUnitInfo, as read from <code>persistence.xml</code>.
|
||||
* @param pui the chosen PersistenceUnitInfo, as read from {@code persistence.xml}.
|
||||
* Passed in as MutablePersistenceUnitInfo.
|
||||
*/
|
||||
void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui);
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.xml.DomUtils;
|
||||
import org.springframework.util.xml.SimpleSaxErrorHandler;
|
||||
|
||||
/**
|
||||
* Internal helper class for reading JPA-compliant <code>persistence.xml</code> files.
|
||||
* Internal helper class for reading JPA-compliant {@code persistence.xml} files.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
@@ -93,7 +93,7 @@ class PersistenceUnitReader {
|
||||
* Create a new PersistenceUnitReader.
|
||||
* @param resourcePatternResolver the ResourcePatternResolver to use for loading resources
|
||||
* @param dataSourceLookup the DataSourceLookup to resolve DataSource names in
|
||||
* <code>persistence.xml</code> files against
|
||||
* {@code persistence.xml} files against
|
||||
*/
|
||||
public PersistenceUnitReader(ResourcePatternResolver resourcePatternResolver, DataSourceLookup dataSourceLookup) {
|
||||
Assert.notNull(resourcePatternResolver, "ResourceLoader must not be null");
|
||||
@@ -185,7 +185,7 @@ class PersistenceUnitReader {
|
||||
|
||||
/**
|
||||
* Determine the persistence unit root URL based on the given resource
|
||||
* (which points to the <code>persistence.xml</code> file we're reading).
|
||||
* (which points to the {@code persistence.xml} file we're reading).
|
||||
* @param resource the resource to check
|
||||
* @return the corresponding persistence unit root URL
|
||||
* @throws IOException if the checking failed
|
||||
@@ -291,7 +291,7 @@ class PersistenceUnitReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the <code>property</code> XML elements.
|
||||
* Parse the {@code property} XML elements.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void parseProperties(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) {
|
||||
@@ -308,7 +308,7 @@ class PersistenceUnitReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the <code>class</code> XML elements.
|
||||
* Parse the {@code class} XML elements.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void parseManagedClasses(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) {
|
||||
@@ -321,7 +321,7 @@ class PersistenceUnitReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the <code>mapping-file</code> XML elements.
|
||||
* Parse the {@code mapping-file} XML elements.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void parseMappingFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) {
|
||||
@@ -335,7 +335,7 @@ class PersistenceUnitReader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the <code>jar-file</code> XML elements.
|
||||
* Parse the {@code jar-file} XML elements.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void parseJarFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) throws IOException {
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.orm.jpa.JpaTemplate;
|
||||
*
|
||||
* <p>This class will create its own JpaTemplate if an EntityManagerFactory
|
||||
* or EntityManager reference is passed in. A custom JpaTemplate instance
|
||||
* can be used through overriding <code>createJpaTemplate</code>.
|
||||
* can be used through overriding {@code createJpaTemplate}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
@@ -44,7 +44,7 @@ import org.springframework.orm.jpa.JpaTemplate;
|
||||
* @see #setJpaTemplate
|
||||
* @see org.springframework.orm.jpa.JpaTemplate
|
||||
* @deprecated as of Spring 3.1, in favor of native EntityManager usage
|
||||
* (typically obtained through <code>@PersistenceContext</code>)
|
||||
* (typically obtained through {@code @PersistenceContext})
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class JpaDaoSupport extends DaoSupport {
|
||||
|
||||
@@ -53,10 +53,10 @@ import org.springframework.web.filter.OncePerRequestFilter;
|
||||
* as for non-transactional read-only execution.
|
||||
*
|
||||
* <p>Looks up the EntityManagerFactory in Spring's root web application context.
|
||||
* Supports an "entityManagerFactoryBeanName" filter init-param in <code>web.xml</code>;
|
||||
* Supports an "entityManagerFactoryBeanName" filter init-param in {@code web.xml};
|
||||
* the default bean name is "entityManagerFactory". As an alternative, the
|
||||
* "persistenceUnitName" init-param allows for retrieval by logical unit name
|
||||
* (as specified in <code>persistence.xml</code>).
|
||||
* (as specified in {@code persistence.xml}).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
@@ -195,7 +195,7 @@ public class OpenEntityManagerInViewFilter extends OncePerRequestFilter {
|
||||
/**
|
||||
* Look up the EntityManagerFactory that this filter should use,
|
||||
* taking the current HTTP request as argument.
|
||||
* <p>The default implementation delegates to the <code>lookupEntityManagerFactory</code>
|
||||
* <p>The default implementation delegates to the {@code lookupEntityManagerFactory}
|
||||
* without arguments, caching the EntityManagerFactory reference once obtained.
|
||||
* @return the EntityManagerFactory to use
|
||||
* @see #lookupEntityManagerFactory()
|
||||
|
||||
@@ -69,14 +69,14 @@ import org.springframework.util.StringUtils;
|
||||
* and {@link javax.persistence.EntityManager}. Any such annotated fields or methods
|
||||
* in any Spring-managed object will automatically be injected.
|
||||
*
|
||||
* <p>This post-processor will inject sub-interfaces of <code>EntityManagerFactory</code>
|
||||
* and <code>EntityManager</code> if the annotated fields or methods are declared as such.
|
||||
* <p>This post-processor will inject sub-interfaces of {@code EntityManagerFactory}
|
||||
* and {@code EntityManager} if the annotated fields or methods are declared as such.
|
||||
* The actual type will be verified early, with the exception of a shared ("transactional")
|
||||
* <code>EntityManager</code> reference, where type mismatches might be detected as late
|
||||
* {@code EntityManager} reference, where type mismatches might be detected as late
|
||||
* as on the first actual invocation.
|
||||
*
|
||||
* <p>Note: In the present implementation, PersistenceAnnotationBeanPostProcessor
|
||||
* only supports <code>@PersistenceUnit</code> and <code>@PersistenceContext</code>
|
||||
* only supports {@code @PersistenceUnit} and {@code @PersistenceContext}
|
||||
* with the "unitName" attribute, or no attribute at all (for the default unit).
|
||||
* If those annotations are present with the "name" attribute at the class level,
|
||||
* they will simply be ignored, since those only serve as deployment hint
|
||||
@@ -89,7 +89,7 @@ import org.springframework.util.StringUtils;
|
||||
* with the bean name used as fallback unit name if no deployed name found.
|
||||
* Typically, Spring's {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean}
|
||||
* will be used for setting up such EntityManagerFactory beans. Alternatively,
|
||||
* such beans may also be obtained from JNDI, e.g. using the <code>jee:jndi-lookup</code>
|
||||
* such beans may also be obtained from JNDI, e.g. using the {@code jee:jndi-lookup}
|
||||
* XML configuration element (with the bean name matching the requested unit name).
|
||||
* In both cases, the post-processor definition will look as simple as this:
|
||||
*
|
||||
@@ -98,7 +98,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* In the JNDI case, specify the corresponding JNDI names in this post-processor's
|
||||
* {@link #setPersistenceUnits "persistenceUnits" map}, typically with matching
|
||||
* <code>persistence-unit-ref</code> entries in the Java EE deployment descriptor.
|
||||
* {@code persistence-unit-ref} entries in the Java EE deployment descriptor.
|
||||
* By default, those names are considered as resource references (according to the
|
||||
* Java EE resource-ref convention), located underneath the "java:comp/env/" namespace.
|
||||
* For example:
|
||||
@@ -119,13 +119,13 @@ import org.springframework.util.StringUtils;
|
||||
* Persistence contexts (i.e. EntityManager references) will be built based on
|
||||
* those server-provided EntityManagerFactory references, using Spring's own
|
||||
* transaction synchronization facilities for transactional EntityManager handling
|
||||
* (typically with Spring's <code>@Transactional</code> annotation for demarcation
|
||||
* (typically with Spring's {@code @Transactional} annotation for demarcation
|
||||
* and {@link org.springframework.transaction.jta.JtaTransactionManager} as backend).
|
||||
*
|
||||
* <p>If you prefer the Java EE server's own EntityManager handling, specify entries
|
||||
* in this post-processor's {@link #setPersistenceContexts "persistenceContexts" map}
|
||||
* (or {@link #setExtendedPersistenceContexts "extendedPersistenceContexts" map},
|
||||
* typically with matching <code>persistence-context-ref</code> entries in the
|
||||
* typically with matching {@code persistence-context-ref} entries in the
|
||||
* Java EE deployment descriptor. For example:
|
||||
*
|
||||
* <pre class="code">
|
||||
@@ -144,7 +144,7 @@ import org.springframework.util.StringUtils;
|
||||
* pointing to matching JNDI locations.
|
||||
*
|
||||
* <p><b>NOTE: In general, do not inject EXTENDED EntityManagers into STATELESS beans,
|
||||
* i.e. do not use <code>@PersistenceContext</code> with type <code>EXTENDED</code> in
|
||||
* i.e. do not use {@code @PersistenceContext} with type {@code EXTENDED} in
|
||||
* Spring beans defined with scope 'singleton' (Spring's default scope).</b>
|
||||
* Extended EntityManagers are <i>not</i> thread-safe, hence they must not be used
|
||||
* in concurrently accessed beans (which Spring-managed singletons usually are).
|
||||
@@ -218,7 +218,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* Specify the persistence units for EntityManagerFactory lookups,
|
||||
* as a Map from persistence unit name to persistence unit JNDI name
|
||||
* (which needs to resolve to an EntityManagerFactory instance).
|
||||
* <p>JNDI names specified here should refer to <code>persistence-unit-ref</code>
|
||||
* <p>JNDI names specified here should refer to {@code persistence-unit-ref}
|
||||
* entries in the Java EE deployment descriptor, matching the target persistence unit.
|
||||
* <p>In case of no unit name specified in the annotation, the specified value
|
||||
* for the {@link #setDefaultPersistenceUnitName default persistence unit}
|
||||
@@ -229,7 +229,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* references obtained from JNDI. No separate EntityManagerFactory bean
|
||||
* definitions are necessary in such a scenario.
|
||||
* <p>If no corresponding "persistenceContexts"/"extendedPersistenceContexts"
|
||||
* are specified, <code>@PersistenceContext</code> will be resolved to
|
||||
* are specified, {@code @PersistenceContext} will be resolved to
|
||||
* EntityManagers built on top of the EntityManagerFactory defined here.
|
||||
* Note that those will be Spring-managed EntityManagers, which implement
|
||||
* transaction synchronization based on Spring's facilities.
|
||||
@@ -244,9 +244,9 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* Specify the <i>transactional</i> persistence contexts for EntityManager lookups,
|
||||
* as a Map from persistence unit name to persistence context JNDI name
|
||||
* (which needs to resolve to an EntityManager instance).
|
||||
* <p>JNDI names specified here should refer to <code>persistence-context-ref</code>
|
||||
* <p>JNDI names specified here should refer to {@code persistence-context-ref}
|
||||
* entries in the Java EE deployment descriptors, matching the target persistence unit
|
||||
* and being set up with persistence context type <code>Transaction</code>.
|
||||
* and being set up with persistence context type {@code Transaction}.
|
||||
* <p>In case of no unit name specified in the annotation, the specified value
|
||||
* for the {@link #setDefaultPersistenceUnitName default persistence unit}
|
||||
* will be taken (by default, the value mapped to the empty String),
|
||||
@@ -265,9 +265,9 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* Specify the <i>extended</i> persistence contexts for EntityManager lookups,
|
||||
* as a Map from persistence unit name to persistence context JNDI name
|
||||
* (which needs to resolve to an EntityManager instance).
|
||||
* <p>JNDI names specified here should refer to <code>persistence-context-ref</code>
|
||||
* <p>JNDI names specified here should refer to {@code persistence-context-ref}
|
||||
* entries in the Java EE deployment descriptors, matching the target persistence unit
|
||||
* and being set up with persistence context type <code>Extended</code>.
|
||||
* and being set up with persistence context type {@code Extended}.
|
||||
* <p>In case of no unit name specified in the annotation, the specified value
|
||||
* for the {@link #setDefaultPersistenceUnitName default persistence unit}
|
||||
* will be taken (by default, the value mapped to the empty String),
|
||||
@@ -284,8 +284,8 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
|
||||
/**
|
||||
* Specify the default persistence unit name, to be used in case
|
||||
* of no unit name specified in an <code>@PersistenceUnit</code> /
|
||||
* <code>@PersistenceContext</code> annotation.
|
||||
* of no unit name specified in an {@code @PersistenceUnit} /
|
||||
* {@code @PersistenceContext} annotation.
|
||||
* <p>This is mainly intended for lookups in the application context,
|
||||
* indicating the target persistence unit name (typically matching
|
||||
* the bean name), but also applies to lookups in the
|
||||
@@ -414,7 +414,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* as defined through the "persistenceUnits" map.
|
||||
* @param unitName the name of the persistence unit
|
||||
* @return the corresponding EntityManagerFactory,
|
||||
* or <code>null</code> if none found
|
||||
* or {@code null} if none found
|
||||
* @see #setPersistenceUnits
|
||||
*/
|
||||
protected EntityManagerFactory getPersistenceUnit(String unitName) {
|
||||
@@ -444,7 +444,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* through the "persistenceContexts" (or "extendedPersistenceContexts") map.
|
||||
* @param unitName the name of the persistence unit
|
||||
* @param extended whether to obtain an extended persistence context
|
||||
* @return the corresponding EntityManager, or <code>null</code> if none found
|
||||
* @return the corresponding EntityManager, or {@code null} if none found
|
||||
* @see #setPersistenceContexts
|
||||
* @see #setExtendedPersistenceContexts
|
||||
*/
|
||||
@@ -475,7 +475,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
* Find an EntityManagerFactory with the given name in the current Spring
|
||||
* application context, falling back to a single default EntityManagerFactory
|
||||
* (if any) in case of no unit name specified.
|
||||
* @param unitName the name of the persistence unit (may be <code>null</code> or empty)
|
||||
* @param unitName the name of the persistence unit (may be {@code null} or empty)
|
||||
* @param requestingBeanName the name of the requesting bean
|
||||
* @return the EntityManagerFactory
|
||||
* @throws NoSuchBeanDefinitionException if there is no such EntityManagerFactory in the context
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SharedEntityManagerBean extends EntityManagerFactoryAccessor
|
||||
* Specify the EntityManager interface to expose.
|
||||
* <p>Default is the EntityManager interface as defined by the
|
||||
* EntityManagerFactoryInfo, if available. Else, the standard
|
||||
* <code>javax.persistence.EntityManager</code> interface will be used.
|
||||
* {@code javax.persistence.EntityManager} interface will be used.
|
||||
* @see org.springframework.orm.jpa.EntityManagerFactoryInfo#getEntityManagerInterface()
|
||||
* @see javax.persistence.EntityManager
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* Classes supporting the <code>org.springframework.orm.jpa</code> package.
|
||||
* Classes supporting the {@code org.springframework.orm.jpa} package.
|
||||
* Contains a DAO base class for JpaTemplate usage.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
|
||||
|
||||
|
||||
/**
|
||||
* Specify the target database to operate on, as a value of the <code>Database</code> enum:
|
||||
* Specify the target database to operate on, as a value of the {@code Database} enum:
|
||||
* DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
|
||||
*/
|
||||
public void setDatabase(Database database) {
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.springframework.orm.jpa.vendor;
|
||||
* the strategy class can still be specified using the fully-qualified class name.
|
||||
* This enumeration is merely a convenience. The database products listed here
|
||||
* are the same as those explicitly supported for Spring JDBC exception translation
|
||||
* in <code>sql-error-codes.xml</code>.
|
||||
* in {@code sql-error-codes.xml}.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -90,7 +90,7 @@ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
/**
|
||||
* Determine the EclipseLink target database name for the given database.
|
||||
* @param database the specified database
|
||||
* @return the EclipseLink target database name, or <code>null<code> if none found
|
||||
* @return the EclipseLink target database name, or {@code null} if none found
|
||||
*/
|
||||
protected String determineTargetDatabaseName(Database database) {
|
||||
switch (database) {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.orm.jpa.EntityManagerFactoryAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Simple <code>FactoryBean</code> that exposes the underlying {@link SessionFactory}
|
||||
* Simple {@code FactoryBean} that exposes the underlying {@link SessionFactory}
|
||||
* behind a Hibernate-backed JPA {@link EntityManagerFactory}.
|
||||
*
|
||||
* <p>Primarily available for resolving a SessionFactory by JPA persistence unit name
|
||||
|
||||
@@ -95,7 +95,7 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
/**
|
||||
* Determine the Hibernate database dialect class for the given target database.
|
||||
* @param database the target database
|
||||
* @return the Hibernate database dialect class, or <code>null<code> if none found
|
||||
* @return the Hibernate database dialect class, or {@code null} if none found
|
||||
*/
|
||||
protected Class determineDatabaseDialectClass(Database database) {
|
||||
switch (database) {
|
||||
|
||||
@@ -64,9 +64,9 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the OpenJPA-specific interface of <code>EntityManager</code>.
|
||||
* @param em the generic <code>EntityManager</code> instance
|
||||
* @return the OpenJPA-specific interface of <code>EntityManager</code>
|
||||
* Return the OpenJPA-specific interface of {@code EntityManager}.
|
||||
* @param em the generic {@code EntityManager} instance
|
||||
* @return the OpenJPA-specific interface of {@code EntityManager}
|
||||
*/
|
||||
protected OpenJPAEntityManager getOpenJPAEntityManager(EntityManager em) {
|
||||
return OpenJPAPersistence.cast(em);
|
||||
@@ -74,7 +74,7 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
|
||||
|
||||
/**
|
||||
* Transaction data Object exposed from <code>beginTransaction</code>,
|
||||
* Transaction data Object exposed from {@code beginTransaction},
|
||||
* implementing the SavepointManager interface.
|
||||
*/
|
||||
private static class OpenJpaTransactionData implements SavepointManager {
|
||||
@@ -106,8 +106,8 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
|
||||
/**
|
||||
* ConnectionHandle implementation that fetches a new OpenJPA-provided Connection
|
||||
* for every <code>getConnection</code> call and closes the Connection on
|
||||
* <code>releaseConnection</code>. This is necessary because OpenJPA requires the
|
||||
* for every {@code getConnection} call and closes the Connection on
|
||||
* {@code releaseConnection}. This is necessary because OpenJPA requires the
|
||||
* fetched Connection to be closed before continuing EntityManager work.
|
||||
* @see org.apache.openjpa.persistence.OpenJPAEntityManager#getConnection()
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
/**
|
||||
* Determine the OpenJPA database dictionary name for the given database.
|
||||
* @param database the specified database
|
||||
* @return the OpenJPA database dictionary name, or <code>null<code> if none found
|
||||
* @return the OpenJPA database dictionary name, or {@code null} if none found
|
||||
*/
|
||||
protected String determineDatabaseDictionary(Database database) {
|
||||
switch (database) {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class TopLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
/**
|
||||
* Determine the TopLink target database name for the given database.
|
||||
* @param database the specified database
|
||||
* @return the TopLink target database name, or <code>null<code> if none found
|
||||
* @return the TopLink target database name, or {@code null} if none found
|
||||
*/
|
||||
protected String determineTargetDatabaseName(Database database) {
|
||||
switch (database) {
|
||||
|
||||
Reference in New Issue
Block a user