Added @Override and @Deprecated annotations to orm module
This commit is contained in:
@@ -445,6 +445,7 @@ public interface HibernateOperations {
|
||||
* @deprecated as of Spring 2.5, in favor of individual
|
||||
* <code>saveOrUpdate</code> or <code>merge</code> usage
|
||||
*/
|
||||
@Deprecated
|
||||
void saveOrUpdateAll(Collection entities) throws DataAccessException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -383,6 +383,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
|
||||
* @deprecated as of Spring 2.5, in favor of {@link #executeWithNativeSession}
|
||||
*/
|
||||
@Deprecated
|
||||
public Object execute(HibernateCallback action, boolean enforceNativeSession) throws DataAccessException {
|
||||
return doExecute(action, false, enforceNativeSession);
|
||||
}
|
||||
|
||||
@@ -431,6 +431,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
return getSessionFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
HibernateTransactionObject txObject = new HibernateTransactionObject();
|
||||
txObject.setSavepointAllowed(isNestedTransactionAllowed());
|
||||
@@ -468,12 +469,14 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
return txObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isExistingTransaction(Object transaction) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) transaction;
|
||||
return (txObject.hasSpringManagedTransaction() ||
|
||||
(this.hibernateManagedSession && txObject.hasHibernateManagedTransaction()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) transaction;
|
||||
|
||||
@@ -600,6 +603,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doSuspend(Object transaction) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) transaction;
|
||||
txObject.setSessionHolder(null);
|
||||
@@ -613,6 +617,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
return new SuspendedResourcesHolder(sessionHolder, connectionHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doResume(Object transaction, Object suspendedResources) {
|
||||
SuspendedResourcesHolder resourcesHolder = (SuspendedResourcesHolder) suspendedResources;
|
||||
if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
|
||||
@@ -626,6 +631,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepareForCommit(DefaultTransactionStatus status) {
|
||||
if (this.earlyFlushBeforeCommit) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
|
||||
@@ -645,6 +651,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -664,6 +671,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -689,6 +697,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -698,6 +707,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
txObject.setRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCleanupAfterCompletion(Object transaction) {
|
||||
HibernateTransactionObject txObject = (HibernateTransactionObject) transaction;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ public class LocalJtaDataSourceConnectionProvider extends LocalDataSourceConnect
|
||||
* This implementation returns <code>true</code>,
|
||||
* since we're assuming a JTA DataSource.
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsAggressiveRelease() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -512,6 +512,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected SessionFactory buildSessionFactory() throws Exception {
|
||||
// Create Configuration instance.
|
||||
Configuration config = newConfiguration();
|
||||
@@ -831,6 +832,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
* @see #setSchemaUpdate
|
||||
* @see #updateDatabaseSchema()
|
||||
*/
|
||||
@Override
|
||||
protected void afterSessionFactoryCreation() throws Exception {
|
||||
if (this.schemaUpdate) {
|
||||
DataSource dataSource = getDataSource();
|
||||
@@ -854,6 +856,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
/**
|
||||
* Allows for schema export on shutdown.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() throws HibernateException {
|
||||
DataSource dataSource = getDataSource();
|
||||
if (dataSource != null) {
|
||||
|
||||
@@ -144,6 +144,7 @@ public class SessionHolder extends ResourceHolderSupport {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.transaction = null;
|
||||
|
||||
@@ -35,6 +35,7 @@ public class TransactionAwareDataSourceConnectionProvider extends LocalDataSourc
|
||||
* Return a TransactionAwareDataSourceProxy for the given DataSource,
|
||||
* provided that it isn't a TransactionAwareDataSourceProxy already.
|
||||
*/
|
||||
@Override
|
||||
protected DataSource getDataSourceToUse(DataSource originalDataSource) {
|
||||
if (originalDataSource instanceof TransactionAwareDataSourceProxy) {
|
||||
return originalDataSource;
|
||||
@@ -47,6 +48,7 @@ public class TransactionAwareDataSourceConnectionProvider extends LocalDataSourc
|
||||
* to receive the same Connection within a transaction, as we are
|
||||
* exposing a TransactionAwareDataSourceProxy.
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsAggressiveRelease() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setConfigurationClass(Class configurationClass) {
|
||||
if (configurationClass == null || !AnnotationConfiguration.class.isAssignableFrom(configurationClass)) {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -159,6 +160,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
* Reads metadata from annotated classes and packages into the
|
||||
* AnnotationConfiguration instance.
|
||||
*/
|
||||
@Override
|
||||
protected void postProcessMappings(Configuration config) throws HibernateException {
|
||||
AnnotationConfiguration annConfig = (AnnotationConfiguration) config;
|
||||
if (this.annotatedClasses != null) {
|
||||
@@ -225,6 +227,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
/**
|
||||
* Delegates to {@link #postProcessAnnotationConfiguration}.
|
||||
*/
|
||||
@Override
|
||||
protected final void postProcessConfiguration(Configuration config) throws HibernateException {
|
||||
postProcessAnnotationConfiguration((AnnotationConfiguration) config);
|
||||
}
|
||||
|
||||
@@ -68,15 +68,18 @@ public class BlobByteArrayType extends AbstractLobType {
|
||||
return byte[].class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object x, Object y) {
|
||||
return (x == y) ||
|
||||
(x instanceof byte[] && y instanceof byte[] && Arrays.equals((byte[]) x, (byte[]) y));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object deepCopy(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
@@ -87,6 +90,7 @@ public class BlobByteArrayType extends AbstractLobType {
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object nullSafeGetInternal(
|
||||
ResultSet rs, String[] names, Object owner, LobHandler lobHandler)
|
||||
throws SQLException {
|
||||
@@ -94,6 +98,7 @@ public class BlobByteArrayType extends AbstractLobType {
|
||||
return lobHandler.getBlobAsBytes(rs, names[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nullSafeSetInternal(
|
||||
PreparedStatement ps, int index, Object value, LobCreator lobCreator)
|
||||
throws SQLException {
|
||||
|
||||
@@ -84,10 +84,12 @@ public class BlobSerializableType extends AbstractLobType {
|
||||
return Serializable.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
try {
|
||||
// Write to new byte array to clone.
|
||||
@@ -118,6 +120,7 @@ public class BlobSerializableType extends AbstractLobType {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object nullSafeGetInternal(
|
||||
ResultSet rs, String[] names, Object owner, LobHandler lobHandler)
|
||||
throws SQLException, IOException, HibernateException {
|
||||
@@ -140,6 +143,7 @@ public class BlobSerializableType extends AbstractLobType {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nullSafeSetInternal(
|
||||
PreparedStatement ps, int index, Object value, LobCreator lobCreator)
|
||||
throws SQLException, IOException {
|
||||
|
||||
@@ -74,6 +74,7 @@ public class BlobStringType extends AbstractLobType {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object nullSafeGetInternal(
|
||||
ResultSet rs, String[] names, Object owner, LobHandler lobHandler)
|
||||
throws SQLException, UnsupportedEncodingException {
|
||||
@@ -88,6 +89,7 @@ public class BlobStringType extends AbstractLobType {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nullSafeSetInternal(
|
||||
PreparedStatement ps, int index, Object value, LobCreator lobCreator)
|
||||
throws SQLException, UnsupportedEncodingException {
|
||||
|
||||
@@ -70,6 +70,7 @@ public class ClobStringType extends AbstractLobType {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object nullSafeGetInternal(
|
||||
ResultSet rs, String[] names, Object owner, LobHandler lobHandler)
|
||||
throws SQLException {
|
||||
@@ -77,6 +78,7 @@ public class ClobStringType extends AbstractLobType {
|
||||
return lobHandler.getClobAsString(rs, names[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nullSafeSetInternal(
|
||||
PreparedStatement ps, int index, Object value, LobCreator lobCreator)
|
||||
throws SQLException {
|
||||
|
||||
@@ -112,6 +112,7 @@ public abstract class HibernateDaoSupport extends DaoSupport {
|
||||
return this.hibernateTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void checkDaoConfig() {
|
||||
if (this.hibernateTemplate == null) {
|
||||
throw new IllegalArgumentException("'sessionFactory' or 'hibernateTemplate' is required");
|
||||
|
||||
@@ -54,6 +54,7 @@ public class IdTransferringMergeEventListener extends DefaultMergeEventListener
|
||||
/**
|
||||
* Hibernate 3.1 implementation of ID transferral.
|
||||
*/
|
||||
@Override
|
||||
protected void entityIsTransient(MergeEvent event, Map copyCache) {
|
||||
super.entityIsTransient(event, copyCache);
|
||||
SessionImplementor session = event.getSession();
|
||||
|
||||
@@ -164,6 +164,7 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(
|
||||
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.aop.support.AopUtils;
|
||||
*/
|
||||
public class ScopedBeanInterceptor extends EmptyInterceptor {
|
||||
|
||||
@Override
|
||||
public String getEntityName(Object entity) {
|
||||
if (entity instanceof ScopedObject) {
|
||||
// Determine underlying object's type.
|
||||
|
||||
@@ -108,6 +108,7 @@ public interface SqlMapClientOperations {
|
||||
* @deprecated as of iBATIS 2.3.0
|
||||
* @throws org.springframework.dao.DataAccessException in case of errors
|
||||
*/
|
||||
@Deprecated
|
||||
PaginatedList queryForPaginatedList(String statementName, int pageSize)
|
||||
throws DataAccessException;
|
||||
|
||||
@@ -116,6 +117,7 @@ public interface SqlMapClientOperations {
|
||||
* @deprecated as of iBATIS 2.3.0
|
||||
* @throws org.springframework.dao.DataAccessException in case of errors
|
||||
*/
|
||||
@Deprecated
|
||||
PaginatedList queryForPaginatedList(String statementName, Object parameterObject, int pageSize)
|
||||
throws DataAccessException;
|
||||
|
||||
|
||||
@@ -137,11 +137,13 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
* If no DataSource specified, use SqlMapClient's DataSource.
|
||||
* @see com.ibatis.sqlmap.client.SqlMapClient#getDataSource()
|
||||
*/
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
DataSource ds = super.getDataSource();
|
||||
return (ds != null ? ds : this.sqlMapClient.getDataSource());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (this.sqlMapClient == null) {
|
||||
throw new IllegalArgumentException("Property 'sqlMapClient' is required");
|
||||
@@ -338,6 +340,7 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
/**
|
||||
* @deprecated as of iBATIS 2.3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public PaginatedList queryForPaginatedList(String statementName, int pageSize)
|
||||
throws DataAccessException {
|
||||
|
||||
@@ -347,6 +350,7 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
/**
|
||||
* @deprecated as of iBATIS 2.3.0
|
||||
*/
|
||||
@Deprecated
|
||||
public PaginatedList queryForPaginatedList(
|
||||
final String statementName, final Object parameterObject, final int pageSize)
|
||||
throws DataAccessException {
|
||||
|
||||
@@ -181,10 +181,12 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
|
||||
this.lobCreator = lobCreator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return LOB_CREATOR_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCompletion() {
|
||||
this.lobCreator.close();
|
||||
}
|
||||
|
||||
@@ -54,12 +54,14 @@ public class BlobByteArrayTypeHandler extends AbstractLobTypeHandler {
|
||||
super(lobHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setParameterInternal(
|
||||
PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
|
||||
throws SQLException {
|
||||
lobCreator.setBlobAsBytes(ps, index, (byte[]) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler)
|
||||
throws SQLException {
|
||||
return lobHandler.getBlobAsBytes(rs, index);
|
||||
|
||||
@@ -59,6 +59,7 @@ public class BlobSerializableTypeHandler extends AbstractLobTypeHandler {
|
||||
super(lobHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setParameterInternal(
|
||||
PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
|
||||
throws SQLException, IOException {
|
||||
@@ -80,6 +81,7 @@ public class BlobSerializableTypeHandler extends AbstractLobTypeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler)
|
||||
throws SQLException, IOException {
|
||||
|
||||
|
||||
@@ -57,12 +57,14 @@ public class ClobStringTypeHandler extends AbstractLobTypeHandler {
|
||||
super(lobHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setParameterInternal(
|
||||
PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
|
||||
throws SQLException {
|
||||
lobCreator.setClobAsString(ps, index, (String) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler)
|
||||
throws SQLException {
|
||||
return lobHandler.getClobAsString(rs, index);
|
||||
|
||||
@@ -103,6 +103,7 @@ public abstract class SqlMapClientDaoSupport extends DaoSupport {
|
||||
return this.sqlMapClientTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void checkDaoConfig() {
|
||||
if (!this.externalTemplate) {
|
||||
this.sqlMapClientTemplate.afterPropertiesSet();
|
||||
|
||||
@@ -229,6 +229,7 @@ public interface JdoOperations {
|
||||
* @deprecated in favor of {@link #makePersistent(Object)}.
|
||||
* To be removed in Spring 3.0.
|
||||
*/
|
||||
@Deprecated
|
||||
Object attachCopy(Object detachedEntity);
|
||||
|
||||
/**
|
||||
@@ -243,6 +244,7 @@ public interface JdoOperations {
|
||||
* @deprecated in favor of {@link #makePersistentAll(java.util.Collection)}.
|
||||
* To be removed in Spring 3.0.
|
||||
*/
|
||||
@Deprecated
|
||||
Collection attachCopyAll(Collection detachedEntities);
|
||||
|
||||
/**
|
||||
|
||||
@@ -381,6 +381,7 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
* @deprecated in favor of {@link #makePersistent(Object)}.
|
||||
* To be removed in Spring 3.0.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object attachCopy(Object detachedEntity) {
|
||||
return makePersistent(detachedEntity);
|
||||
}
|
||||
@@ -389,6 +390,7 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
* @deprecated in favor of {@link #makePersistentAll(java.util.Collection)}.
|
||||
* To be removed in Spring 3.0.
|
||||
*/
|
||||
@Deprecated
|
||||
public Collection attachCopyAll(Collection detachedEntities) {
|
||||
return makePersistentAll(detachedEntities);
|
||||
}
|
||||
|
||||
@@ -258,6 +258,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
return getPersistenceManagerFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
JdoTransactionObject txObject = new JdoTransactionObject();
|
||||
txObject.setSavepointAllowed(isNestedTransactionAllowed());
|
||||
@@ -281,10 +282,12 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
return txObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isExistingTransaction(Object transaction) {
|
||||
return ((JdoTransactionObject) transaction).hasTransaction();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
JdoTransactionObject txObject = (JdoTransactionObject) transaction;
|
||||
|
||||
@@ -382,6 +385,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doSuspend(Object transaction) {
|
||||
JdoTransactionObject txObject = (JdoTransactionObject) transaction;
|
||||
txObject.setPersistenceManagerHolder(null, false);
|
||||
@@ -395,6 +399,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
return new SuspendedResourcesHolder(persistenceManagerHolder, connectionHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doResume(Object transaction, Object suspendedResources) {
|
||||
SuspendedResourcesHolder resourcesHolder = (SuspendedResourcesHolder) suspendedResources;
|
||||
TransactionSynchronizationManager.bindResource(
|
||||
@@ -408,10 +413,12 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
* This implementation returns "true": a JDO2 commit will properly handle
|
||||
* transactions that have been marked rollback-only at a global level.
|
||||
*/
|
||||
@Override
|
||||
protected boolean shouldCommitOnGlobalRollbackOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
JdoTransactionObject txObject = (JdoTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -428,6 +435,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
JdoTransactionObject txObject = (JdoTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -445,6 +453,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
|
||||
JdoTransactionObject txObject = (JdoTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -454,6 +463,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
txObject.setRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCleanupAfterCompletion(Object transaction) {
|
||||
JdoTransactionObject txObject = (JdoTransactionObject) transaction;
|
||||
|
||||
|
||||
@@ -308,10 +308,12 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
return PERSISTENCE_MANAGER_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldUnbindAtCompletion() {
|
||||
return this.newPersistenceManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void releaseResource(ResourceHolder resourceHolder, Object resourceKey) {
|
||||
releasePersistenceManager(((PersistenceManagerHolder) resourceHolder).getPersistenceManager(),
|
||||
(PersistenceManagerFactory) resourceKey);
|
||||
|
||||
@@ -58,6 +58,7 @@ public class PersistenceManagerHolder extends ResourceHolderSupport {
|
||||
return this.transactionActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.transactionActive = false;
|
||||
|
||||
@@ -108,6 +108,7 @@ public abstract class JdoDaoSupport extends DaoSupport {
|
||||
return jdoTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void checkDaoConfig() {
|
||||
if (this.jdoTemplate == null) {
|
||||
throw new IllegalArgumentException("persistenceManagerFactory or jdoTemplate is required");
|
||||
|
||||
@@ -83,6 +83,7 @@ public class OpenPersistenceManagerInViewFilter extends OncePerRequestFilter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(
|
||||
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -346,14 +346,17 @@ public abstract class EntityManagerFactoryUtils {
|
||||
return ENTITY_MANAGER_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldUnbindAtCompletion() {
|
||||
return this.newEntityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void releaseResource(ResourceHolder resourceHolder, Object resourceKey) {
|
||||
closeEntityManager(((EntityManagerHolder) resourceHolder).getEntityManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupResource(ResourceHolder resourceHolder, Object resourceKey, boolean committed) {
|
||||
if (!committed) {
|
||||
// Clear all pending inserts/updates/deletes in the EntityManager.
|
||||
|
||||
@@ -69,6 +69,7 @@ public class EntityManagerHolder extends ResourceHolderSupport {
|
||||
return this.savepointManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.transactionActive = false;
|
||||
|
||||
@@ -447,10 +447,12 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
return EntityManagerFactoryUtils.ENTITY_MANAGER_SYNCHRONIZATION_ORDER + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldReleaseBeforeCompletion() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
super.afterCommit();
|
||||
// Trigger commit here to let exceptions propagate to the caller.
|
||||
@@ -462,6 +464,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
super.afterCompletion(status);
|
||||
if (status != STATUS_COMMITTED) {
|
||||
|
||||
@@ -274,6 +274,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
return getEntityManagerFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
JpaTransactionObject txObject = new JpaTransactionObject();
|
||||
txObject.setSavepointAllowed(isNestedTransactionAllowed());
|
||||
@@ -297,10 +298,12 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
return txObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isExistingTransaction(Object transaction) {
|
||||
return ((JpaTransactionObject) transaction).hasTransaction();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
JpaTransactionObject txObject = (JpaTransactionObject) transaction;
|
||||
|
||||
@@ -415,6 +418,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doSuspend(Object transaction) {
|
||||
JpaTransactionObject txObject = (JpaTransactionObject) transaction;
|
||||
txObject.setEntityManagerHolder(null, false);
|
||||
@@ -428,6 +432,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
return new SuspendedResourcesHolder(entityManagerHolder, connectionHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doResume(Object transaction, Object suspendedResources) {
|
||||
SuspendedResourcesHolder resourcesHolder = (SuspendedResourcesHolder) suspendedResources;
|
||||
TransactionSynchronizationManager.bindResource(
|
||||
@@ -441,10 +446,12 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* This implementation returns "true": a JPA commit will properly handle
|
||||
* transactions that have been marked rollback-only at a global level.
|
||||
*/
|
||||
@Override
|
||||
protected boolean shouldCommitOnGlobalRollbackOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
JpaTransactionObject txObject = (JpaTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -470,6 +477,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
JpaTransactionObject txObject = (JpaTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -494,6 +502,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
|
||||
JpaTransactionObject txObject = (JpaTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -503,6 +512,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
txObject.setRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCleanupAfterCompletion(Object transaction) {
|
||||
JpaTransactionObject txObject = (JpaTransactionObject) transaction;
|
||||
|
||||
@@ -598,14 +608,17 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
return tx.getRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createSavepoint() throws TransactionException {
|
||||
return getSavepointManager().createSavepoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollbackToSavepoint(Object savepoint) throws TransactionException {
|
||||
getSavepointManager().rollbackToSavepoint(savepoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseSavepoint(Object savepoint) throws TransactionException {
|
||||
getSavepointManager().releaseSavepoint(savepoint);
|
||||
}
|
||||
|
||||
@@ -260,10 +260,12 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceUnitInfo getPersistenceUnitInfo() {
|
||||
return this.persistenceUnitInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceUnitName() {
|
||||
if (this.persistenceUnitInfo != null) {
|
||||
return this.persistenceUnitInfo.getPersistenceUnitName();
|
||||
@@ -271,6 +273,7 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
return super.getPersistenceUnitName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
if (this.persistenceUnitInfo != null) {
|
||||
return this.persistenceUnitInfo.getNonJtaDataSource();
|
||||
|
||||
@@ -71,6 +71,7 @@ public class LocalEntityManagerFactoryBean extends AbstractEntityManagerFactoryB
|
||||
* Initialize the EntityManagerFactory for the given configuration.
|
||||
* @throws javax.persistence.PersistenceException in case of JPA initialization errors
|
||||
*/
|
||||
@Override
|
||||
protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Building JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'");
|
||||
|
||||
@@ -201,6 +201,7 @@ public class MutablePersistenceUnitInfo implements PersistenceUnitInfo {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("PersistenceUnitInfo: name '");
|
||||
|
||||
@@ -66,6 +66,7 @@ class SpringPersistenceUnitInfo extends MutablePersistenceUnitInfo {
|
||||
* This implementation returns the LoadTimeWeaver's instrumentable ClassLoader,
|
||||
* if specified.
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return this.classLoader;
|
||||
}
|
||||
@@ -73,6 +74,7 @@ class SpringPersistenceUnitInfo extends MutablePersistenceUnitInfo {
|
||||
/**
|
||||
* This implementation delegates to the LoadTimeWeaver, if specified.
|
||||
*/
|
||||
@Override
|
||||
public void addTransformer(ClassTransformer classTransformer) {
|
||||
if (this.loadTimeWeaver == null) {
|
||||
throw new IllegalStateException("Cannot apply class transformer without LoadTimeWeaver specified");
|
||||
@@ -83,6 +85,7 @@ class SpringPersistenceUnitInfo extends MutablePersistenceUnitInfo {
|
||||
/**
|
||||
* This implementation delegates to the LoadTimeWeaver, if specified.
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getNewTempClassLoader() {
|
||||
ClassLoader tcl = (this.loadTimeWeaver != null ? this.loadTimeWeaver.getThrowawayClassLoader() :
|
||||
new SimpleThrowawayClassLoader(this.classLoader));
|
||||
|
||||
@@ -114,6 +114,7 @@ public abstract class JpaDaoSupport extends DaoSupport {
|
||||
return jpaTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void checkDaoConfig() {
|
||||
if (this.jpaTemplate == null) {
|
||||
throw new IllegalArgumentException("entityManagerFactory or jpaTemplate is required");
|
||||
|
||||
@@ -86,6 +86,7 @@ public class OpenEntityManagerInViewFilter extends OncePerRequestFilter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(
|
||||
HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
|
||||
@@ -56,10 +56,12 @@ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderRootPackage() {
|
||||
return "org.eclipse.persistence";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getJpaPropertyMap() {
|
||||
Properties jpaProperties = new Properties();
|
||||
|
||||
@@ -106,10 +108,12 @@ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return this.jpaDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return JpaEntityManager.class;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.springframework.transaction.TransactionException;
|
||||
*/
|
||||
public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
|
||||
@Override
|
||||
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
|
||||
throws PersistenceException, SQLException, TransactionException {
|
||||
|
||||
@@ -53,6 +54,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
return prepareTransaction(entityManager, definition.isReadOnly(), definition.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name)
|
||||
throws PersistenceException {
|
||||
|
||||
@@ -74,6 +76,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
return new SessionTransactionData(session, previousFlushMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
((SessionTransactionData) transactionData).resetFlushMode();
|
||||
}
|
||||
@@ -87,6 +90,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
return (con != null ? new SimpleConnectionHandle(con) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
if (ex instanceof HibernateException) {
|
||||
return SessionFactoryUtils.convertHibernateAccessException((HibernateException) ex);
|
||||
|
||||
@@ -64,10 +64,12 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderRootPackage() {
|
||||
return "org.hibernate";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getJpaPropertyMap() {
|
||||
Properties jpaProperties = new Properties();
|
||||
|
||||
@@ -112,14 +114,17 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return this.jpaDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface() {
|
||||
return HibernateEntityManagerFactory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return HibernateEntityManager.class;
|
||||
}
|
||||
|
||||
@@ -53,10 +53,12 @@ public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderRootPackage() {
|
||||
return "org.apache.openjpa";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getJpaPropertyMap() {
|
||||
Properties jpaProperties = new Properties();
|
||||
|
||||
@@ -102,14 +104,17 @@ public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return this.jpaDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface() {
|
||||
return OpenJPAEntityManagerFactorySPI.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return OpenJPAEntityManagerSPI.class;
|
||||
}
|
||||
|
||||
@@ -53,10 +53,12 @@ public class TopLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderRootPackage() {
|
||||
return "oracle.toplink.essentials";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getJpaPropertyMap() {
|
||||
Properties jpaProperties = new Properties();
|
||||
|
||||
@@ -103,10 +105,12 @@ public class TopLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return this.jpaDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return oracle.toplink.essentials.ejb.cmp3.EntityManager.class;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public class ServerSessionFactory extends AbstractSessionFactory {
|
||||
/**
|
||||
* Return this factory's ServerSession as-is.
|
||||
*/
|
||||
@Override
|
||||
protected Session getMasterSession() {
|
||||
return this.serverSession;
|
||||
}
|
||||
@@ -62,6 +63,7 @@ public class ServerSessionFactory extends AbstractSessionFactory {
|
||||
* Create a plain ClientSession for this factory's ServerSession.
|
||||
* @see oracle.toplink.threetier.ServerSession#acquireClientSession()
|
||||
*/
|
||||
@Override
|
||||
protected Session createClientSession() throws TopLinkException {
|
||||
return this.serverSession.acquireClientSession();
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public class SessionBrokerSessionFactory extends AbstractSessionFactory {
|
||||
* @see #createClientSession()
|
||||
* @see #getMasterSession()
|
||||
*/
|
||||
@Override
|
||||
public Session createSession() throws TopLinkException {
|
||||
try {
|
||||
return createClientSession();
|
||||
@@ -80,6 +81,7 @@ public class SessionBrokerSessionFactory extends AbstractSessionFactory {
|
||||
/**
|
||||
* Return this factory's SessionBroker as-is.
|
||||
*/
|
||||
@Override
|
||||
protected Session getMasterSession() {
|
||||
return this.sessionBroker;
|
||||
}
|
||||
@@ -88,6 +90,7 @@ public class SessionBrokerSessionFactory extends AbstractSessionFactory {
|
||||
* Create a plain client SessionBroker for this factory's ServerSession.
|
||||
* @see oracle.toplink.sessionbroker.SessionBroker#acquireClientSessionBroker()
|
||||
*/
|
||||
@Override
|
||||
protected Session createClientSession() throws TopLinkException {
|
||||
return this.sessionBroker.acquireClientSessionBroker();
|
||||
}
|
||||
|
||||
@@ -223,10 +223,12 @@ public abstract class SessionFactoryUtils {
|
||||
super(sessionHolder, sessionFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldReleaseBeforeCompletion() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void releaseResource(ResourceHolder resourceHolder, Object resourceKey) {
|
||||
releaseSession(((SessionHolder) resourceHolder).getSession(), (SessionFactory) resourceKey);
|
||||
}
|
||||
|
||||
@@ -187,6 +187,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
if (args != null) {
|
||||
return session.executeQuery(queryName, entityClass, new Vector(Arrays.asList(args)));
|
||||
@@ -214,6 +215,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
if (args != null) {
|
||||
return session.executeQuery(query, new Vector(Arrays.asList(args)));
|
||||
@@ -236,6 +238,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public List readAll(final Class entityClass, final boolean enforceReadOnly) throws DataAccessException {
|
||||
return executeFind(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
return session.readAllObjects(entityClass);
|
||||
}
|
||||
@@ -250,6 +253,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
throws DataAccessException {
|
||||
|
||||
return executeFind(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
return session.readAllObjects(entityClass, expression);
|
||||
}
|
||||
@@ -264,6 +268,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
throws DataAccessException {
|
||||
|
||||
return executeFind(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
return session.readAllObjects(entityClass, call);
|
||||
}
|
||||
@@ -278,6 +283,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
return session.readObject(entityClass, expression);
|
||||
}
|
||||
@@ -292,6 +298,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
return session.readObject(entityClass, call);
|
||||
}
|
||||
@@ -403,6 +410,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object refresh(final Object entity, final boolean enforceReadOnly) throws DataAccessException {
|
||||
return execute(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
return session.refreshObject(entity);
|
||||
}
|
||||
@@ -415,6 +423,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public List refreshAll(final Collection entities, final boolean enforceReadOnly) throws DataAccessException {
|
||||
return (List) execute(new SessionReadCallback(enforceReadOnly) {
|
||||
@Override
|
||||
protected Object readFromSession(Session session) throws TopLinkException {
|
||||
List result = new ArrayList(entities.size());
|
||||
for (Iterator it = entities.iterator(); it.hasNext();) {
|
||||
@@ -433,6 +442,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object register(final Object entity) {
|
||||
return execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.registerObject(entity);
|
||||
}
|
||||
@@ -441,6 +451,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public List registerAll(final Collection entities) {
|
||||
return (List) execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.registerAllObjects(entities);
|
||||
}
|
||||
@@ -449,6 +460,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public void registerNew(final Object entity) {
|
||||
execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.registerNewObject(entity);
|
||||
}
|
||||
@@ -457,6 +469,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object registerExisting(final Object entity) {
|
||||
return execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.registerExistingObject(entity);
|
||||
}
|
||||
@@ -465,6 +478,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object merge(final Object entity) throws DataAccessException {
|
||||
return execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.mergeClone(entity);
|
||||
}
|
||||
@@ -473,6 +487,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object deepMerge(final Object entity) throws DataAccessException {
|
||||
return execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.deepMergeClone(entity);
|
||||
}
|
||||
@@ -481,6 +496,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object shallowMerge(final Object entity) throws DataAccessException {
|
||||
return execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.shallowMergeClone(entity);
|
||||
}
|
||||
@@ -489,6 +505,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public Object mergeWithReferences(final Object entity) throws DataAccessException {
|
||||
return execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.mergeCloneWithReferences(entity);
|
||||
}
|
||||
@@ -497,6 +514,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public void delete(final Object entity) throws DataAccessException {
|
||||
execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
return unitOfWork.deleteObject(entity);
|
||||
}
|
||||
@@ -505,6 +523,7 @@ public class TopLinkTemplate extends TopLinkAccessor implements TopLinkOperation
|
||||
|
||||
public void deleteAll(final Collection entities) throws DataAccessException {
|
||||
execute(new UnitOfWorkCallback() {
|
||||
@Override
|
||||
protected Object doInUnitOfWork(UnitOfWork unitOfWork) throws TopLinkException {
|
||||
unitOfWork.deleteAllObjects(entities);
|
||||
return null;
|
||||
|
||||
@@ -251,6 +251,7 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
return getSessionFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
TopLinkTransactionObject txObject = new TopLinkTransactionObject();
|
||||
SessionHolder sessionHolder = (SessionHolder)
|
||||
@@ -259,11 +260,13 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
return txObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isExistingTransaction(Object transaction) {
|
||||
TopLinkTransactionObject txObject = (TopLinkTransactionObject) transaction;
|
||||
return (txObject.getSessionHolder() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
Session session = null;
|
||||
|
||||
@@ -358,12 +361,14 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
return ((DatabaseAccessor) accessor).getConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doSuspend(Object transaction) {
|
||||
TopLinkTransactionObject txObject = (TopLinkTransactionObject) transaction;
|
||||
txObject.setSessionHolder(null);
|
||||
return TransactionSynchronizationManager.unbindResource(getSessionFactory());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doResume(Object transaction, Object suspendedResources) {
|
||||
SessionHolder sessionHolder = (SessionHolder) suspendedResources;
|
||||
if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
|
||||
@@ -374,6 +379,7 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
TopLinkTransactionObject txObject = (TopLinkTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -391,6 +397,7 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
TopLinkTransactionObject txObject = (TopLinkTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -400,6 +407,7 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
txObject.getSessionHolder().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
|
||||
TopLinkTransactionObject txObject = (TopLinkTransactionObject) status.getTransaction();
|
||||
if (status.isDebug()) {
|
||||
@@ -409,6 +417,7 @@ public class TopLinkTransactionManager extends AbstractPlatformTransactionManage
|
||||
txObject.getSessionHolder().setRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCleanupAfterCompletion(Object transaction) {
|
||||
TopLinkTransactionObject txObject = (TopLinkTransactionObject) transaction;
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ public class CommonsLoggingSessionLog extends AbstractSessionLog {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void log(SessionLogEntry entry) {
|
||||
Log logger = LogFactory.getLog(getCategory(entry));
|
||||
switch (entry.getLevel()) {
|
||||
|
||||
@@ -75,6 +75,7 @@ public class CommonsLoggingSessionLog904 extends DefaultSessionLog {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void log(SessionLogEntry entry) {
|
||||
if (entry.hasException()) {
|
||||
if (shouldLogExceptions() && logger.isWarnEnabled()) {
|
||||
|
||||
@@ -103,6 +103,7 @@ public abstract class TopLinkDaoSupport extends DaoSupport {
|
||||
return topLinkTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void checkDaoConfig() {
|
||||
if (this.topLinkTemplate == null) {
|
||||
throw new IllegalArgumentException("sessionFactory or topLinkTemplate is required");
|
||||
|
||||
Reference in New Issue
Block a user