Revert "Merge branch 'SPR-10130' into cleanup-master"
This reverts commit45fa50821a, reversing changes made toa312d900f8.
This commit is contained in:
@@ -184,7 +184,6 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
* @see #buildSessionFactory()
|
||||
* @see #wrapSessionFactoryIfNecessary
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
SessionFactory rawSf = buildSessionFactory();
|
||||
this.sessionFactory = wrapSessionFactoryIfNecessary(rawSf);
|
||||
@@ -220,7 +219,6 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
/**
|
||||
* Close the SessionFactory on bean factory shutdown.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() throws HibernateException {
|
||||
logger.info("Closing Hibernate SessionFactory");
|
||||
try {
|
||||
@@ -235,17 +233,14 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
/**
|
||||
* Return the singleton SessionFactory.
|
||||
*/
|
||||
@Override
|
||||
public SessionFactory getObject() {
|
||||
return this.sessionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends SessionFactory> getObjectType() {
|
||||
return (this.sessionFactory != null ? this.sessionFactory.getClass() : SessionFactory.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -137,31 +137,26 @@ public class FilterDefinitionFactoryBean implements FactoryBean<FilterDefinition
|
||||
* the FilterDefinitionFactoryBean will be used.
|
||||
* @see #setFilterName
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
if (this.filterName == null) {
|
||||
this.filterName = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
this.filterDefinition =
|
||||
new FilterDefinition(this.filterName, this.defaultFilterCondition, this.parameterTypeMap);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FilterDefinition getObject() {
|
||||
return this.filterDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FilterDefinition> getObjectType() {
|
||||
return FilterDefinition.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -305,12 +305,10 @@ public abstract class HibernateAccessor implements InitializingBean, BeanFactory
|
||||
* bean names. It does not need to be set for any other mode of operation.
|
||||
* @see #setEntityInterceptorBeanName
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getSessionFactory() == null) {
|
||||
throw new IllegalArgumentException("Property 'sessionFactory' is required");
|
||||
|
||||
@@ -63,7 +63,6 @@ public class HibernateExceptionTranslator implements PersistenceExceptionTransla
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
if (ex instanceof HibernateException) {
|
||||
return convertHibernateAccessException((HibernateException) ex);
|
||||
|
||||
@@ -86,7 +86,6 @@ public class HibernateInterceptor extends HibernateAccessor implements MethodInt
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
Session session = getSession();
|
||||
SessionHolder sessionHolder =
|
||||
|
||||
@@ -335,12 +335,10 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T execute(HibernateCallback<T> action) throws DataAccessException {
|
||||
return doExecute(action, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List executeFind(HibernateCallback<?> action) throws DataAccessException {
|
||||
Object result = doExecute(action, false, false);
|
||||
if (result != null && !(result instanceof List)) {
|
||||
@@ -504,17 +502,14 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
// Convenience methods for loading individual objects
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public <T> T get(Class<T> entityClass, Serializable id) throws DataAccessException {
|
||||
return get(entityClass, id, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(final Class<T> entityClass, final Serializable id, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
return executeWithNativeSession(new HibernateCallback<T>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T doInHibernate(Session session) throws HibernateException {
|
||||
if (lockMode != null) {
|
||||
@@ -527,17 +522,14 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String entityName, Serializable id) throws DataAccessException {
|
||||
return get(entityName, id, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(final String entityName, final Serializable id, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
return executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
if (lockMode != null) {
|
||||
return session.get(entityName, id, lockMode);
|
||||
@@ -549,17 +541,14 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T load(Class<T> entityClass, Serializable id) throws DataAccessException {
|
||||
return load(entityClass, id, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T load(final Class<T> entityClass, final Serializable id, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
return executeWithNativeSession(new HibernateCallback<T>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T doInHibernate(Session session) throws HibernateException {
|
||||
if (lockMode != null) {
|
||||
@@ -572,17 +561,14 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object load(String entityName, Serializable id) throws DataAccessException {
|
||||
return load(entityName, id, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object load(final String entityName, final Serializable id, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
return executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
if (lockMode != null) {
|
||||
return session.load(entityName, id, lockMode);
|
||||
@@ -594,10 +580,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> loadAll(final Class<T> entityClass) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<List<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<T> doInHibernate(Session session) throws HibernateException {
|
||||
Criteria criteria = session.createCriteria(entityClass);
|
||||
@@ -608,10 +592,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(final Object entity, final Serializable id) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
session.load(entity, id);
|
||||
return null;
|
||||
@@ -619,15 +601,12 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(final Object entity) throws DataAccessException {
|
||||
refresh(entity, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(final Object entity, final LockMode lockMode) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
if (lockMode != null) {
|
||||
session.refresh(entity, lockMode);
|
||||
@@ -640,20 +619,16 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(final Object entity) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<Boolean>() {
|
||||
@Override
|
||||
public Boolean doInHibernate(Session session) {
|
||||
return session.contains(entity);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(final Object entity) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
session.evict(entity);
|
||||
return null;
|
||||
@@ -661,7 +636,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Object proxy) throws DataAccessException {
|
||||
try {
|
||||
Hibernate.initialize(proxy);
|
||||
@@ -671,7 +645,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter enableFilter(String filterName) throws IllegalStateException {
|
||||
Session session = SessionFactoryUtils.getSession(getSessionFactory(), false);
|
||||
Filter filter = session.getEnabledFilter(filterName);
|
||||
@@ -686,10 +659,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
// Convenience methods for storing individual objects
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void lock(final Object entity, final LockMode lockMode) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
session.lock(entity, lockMode);
|
||||
return null;
|
||||
@@ -697,12 +668,10 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lock(final String entityName, final Object entity, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
session.lock(entityName, entity, lockMode);
|
||||
return null;
|
||||
@@ -710,10 +679,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable save(final Object entity) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<Serializable>() {
|
||||
@Override
|
||||
public Serializable doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
return session.save(entity);
|
||||
@@ -721,10 +688,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable save(final String entityName, final Object entity) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<Serializable>() {
|
||||
@Override
|
||||
public Serializable doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
return session.save(entityName, entity);
|
||||
@@ -732,15 +697,12 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Object entity) throws DataAccessException {
|
||||
update(entity, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final Object entity, final LockMode lockMode) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.update(entity);
|
||||
@@ -752,17 +714,14 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String entityName, Object entity) throws DataAccessException {
|
||||
update(entityName, entity, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final String entityName, final Object entity, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.update(entityName, entity);
|
||||
@@ -774,10 +733,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(final Object entity) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.saveOrUpdate(entity);
|
||||
@@ -786,10 +743,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(final String entityName, final Object entity) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.saveOrUpdate(entityName, entity);
|
||||
@@ -798,10 +753,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdateAll(final Collection entities) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
for (Object entity : entities) {
|
||||
@@ -812,12 +765,10 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replicate(final Object entity, final ReplicationMode replicationMode)
|
||||
throws DataAccessException {
|
||||
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.replicate(entity, replicationMode);
|
||||
@@ -826,12 +777,10 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replicate(final String entityName, final Object entity, final ReplicationMode replicationMode)
|
||||
throws DataAccessException {
|
||||
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.replicate(entityName, entity, replicationMode);
|
||||
@@ -840,10 +789,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(final Object entity) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.persist(entity);
|
||||
@@ -852,10 +799,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(final String entityName, final Object entity) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
session.persist(entityName, entity);
|
||||
@@ -864,10 +809,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T merge(final T entity) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<T>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
@@ -876,10 +819,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T merge(final String entityName, final T entity) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<T>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public T doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
@@ -888,15 +829,12 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Object entity) throws DataAccessException {
|
||||
delete(entity, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(final Object entity, final LockMode lockMode) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
if (lockMode != null) {
|
||||
@@ -908,17 +846,14 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String entityName, Object entity) throws DataAccessException {
|
||||
delete(entityName, entity, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(final String entityName, final Object entity, final LockMode lockMode)
|
||||
throws DataAccessException {
|
||||
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
if (lockMode != null) {
|
||||
@@ -930,10 +865,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(final Collection entities) throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
checkWriteOperationAllowed(session);
|
||||
for (Object entity : entities) {
|
||||
@@ -944,10 +877,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException {
|
||||
session.flush();
|
||||
return null;
|
||||
@@ -955,10 +886,8 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() throws DataAccessException {
|
||||
executeWithNativeSession(new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) {
|
||||
session.clear();
|
||||
return null;
|
||||
@@ -971,20 +900,16 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
// Convenience finder methods for HQL strings
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public List find(String queryString) throws DataAccessException {
|
||||
return find(queryString, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List find(String queryString, Object value) throws DataAccessException {
|
||||
return find(queryString, new Object[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List find(final String queryString, final Object... values) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -998,14 +923,12 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedParam(String queryString, String paramName, Object value)
|
||||
throws DataAccessException {
|
||||
|
||||
return findByNamedParam(queryString, new String[] {paramName}, new Object[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedParam(final String queryString, final String[] paramNames, final Object[] values)
|
||||
throws DataAccessException {
|
||||
|
||||
@@ -1013,7 +936,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
throw new IllegalArgumentException("Length of paramNames array must match length of values array");
|
||||
}
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1027,12 +949,10 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByValueBean(final String queryString, final Object valueBean)
|
||||
throws DataAccessException {
|
||||
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1047,20 +967,16 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
// Convenience finder methods for named queries
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public List findByNamedQuery(String queryName) throws DataAccessException {
|
||||
return findByNamedQuery(queryName, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQuery(String queryName, Object value) throws DataAccessException {
|
||||
return findByNamedQuery(queryName, new Object[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQuery(final String queryName, final Object... values) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.getNamedQuery(queryName);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1074,14 +990,12 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQueryAndNamedParam(String queryName, String paramName, Object value)
|
||||
throws DataAccessException {
|
||||
|
||||
return findByNamedQueryAndNamedParam(queryName, new String[] {paramName}, new Object[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQueryAndNamedParam(
|
||||
final String queryName, final String[] paramNames, final Object[] values)
|
||||
throws DataAccessException {
|
||||
@@ -1090,7 +1004,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
throw new IllegalArgumentException("Length of paramNames array must match length of values array");
|
||||
}
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.getNamedQuery(queryName);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1104,12 +1017,10 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQueryAndValueBean(final String queryName, final Object valueBean)
|
||||
throws DataAccessException {
|
||||
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.getNamedQuery(queryName);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1124,18 +1035,15 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
// Convenience finder methods for detached criteria
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public List findByCriteria(DetachedCriteria criteria) throws DataAccessException {
|
||||
return findByCriteria(criteria, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByCriteria(final DetachedCriteria criteria, final int firstResult, final int maxResults)
|
||||
throws DataAccessException {
|
||||
|
||||
Assert.notNull(criteria, "DetachedCriteria must not be null");
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Criteria executableCriteria = criteria.getExecutableCriteria(session);
|
||||
prepareCriteria(executableCriteria);
|
||||
@@ -1150,29 +1058,24 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByExample(Object exampleEntity) throws DataAccessException {
|
||||
return findByExample(null, exampleEntity, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByExample(String entityName, Object exampleEntity) throws DataAccessException {
|
||||
return findByExample(entityName, exampleEntity, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByExample(Object exampleEntity, int firstResult, int maxResults) throws DataAccessException {
|
||||
return findByExample(null, exampleEntity, firstResult, maxResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByExample(
|
||||
final String entityName, final Object exampleEntity, final int firstResult, final int maxResults)
|
||||
throws DataAccessException {
|
||||
|
||||
Assert.notNull(exampleEntity, "Example entity must not be null");
|
||||
return executeWithNativeSession(new HibernateCallback<List>() {
|
||||
@Override
|
||||
public List doInHibernate(Session session) throws HibernateException {
|
||||
Criteria executableCriteria = (entityName != null ?
|
||||
session.createCriteria(entityName) : session.createCriteria(exampleEntity.getClass()));
|
||||
@@ -1194,20 +1097,16 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
// Convenience query methods for iteration and bulk updates/deletes
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Iterator iterate(String queryString) throws DataAccessException {
|
||||
return iterate(queryString, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator iterate(String queryString, Object value) throws DataAccessException {
|
||||
return iterate(queryString, new Object[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator iterate(final String queryString, final Object... values) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<Iterator>() {
|
||||
@Override
|
||||
public Iterator doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1221,7 +1120,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeIterator(Iterator it) throws DataAccessException {
|
||||
try {
|
||||
Hibernate.close(it);
|
||||
@@ -1231,20 +1129,16 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bulkUpdate(String queryString) throws DataAccessException {
|
||||
return bulkUpdate(queryString, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bulkUpdate(String queryString, Object value) throws DataAccessException {
|
||||
return bulkUpdate(queryString, new Object[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bulkUpdate(final String queryString, final Object... values) throws DataAccessException {
|
||||
return executeWithNativeSession(new HibernateCallback<Integer>() {
|
||||
@Override
|
||||
public Integer doInHibernate(Session session) throws HibernateException {
|
||||
Query queryObject = session.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -1367,7 +1261,6 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on Session interface coming in...
|
||||
|
||||
|
||||
@@ -395,12 +395,10 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
* bean names. It does not need to be set for any other mode of operation.
|
||||
* @see #setEntityInterceptorBeanName
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getSessionFactory() == null) {
|
||||
throw new IllegalArgumentException("Property 'sessionFactory' is required");
|
||||
@@ -424,7 +422,6 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getResourceFactory() {
|
||||
return getSessionFactory();
|
||||
}
|
||||
@@ -885,13 +882,11 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRollbackOnly() {
|
||||
return this.sessionHolder.isRollbackOnly() ||
|
||||
(hasConnectionHolder() && getConnectionHolder().isRollbackOnly());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
try {
|
||||
this.sessionHolder.getSession().flush();
|
||||
|
||||
@@ -47,27 +47,22 @@ public class LocalCacheProviderProxy implements CacheProvider {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Cache buildCache(String regionName, Properties properties) throws CacheException {
|
||||
return this.cacheProvider.buildCache(regionName, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long nextTimestamp() {
|
||||
return this.cacheProvider.nextTimestamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Properties properties) throws CacheException {
|
||||
this.cacheProvider.start(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
this.cacheProvider.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMinimalPutsEnabledByDefault() {
|
||||
return this.cacheProvider.isMinimalPutsEnabledByDefault();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
private DataSource dataSourceToUse;
|
||||
|
||||
|
||||
@Override
|
||||
public void configure(Properties props) throws HibernateException {
|
||||
this.dataSource = LocalSessionFactoryBean.getConfigTimeDataSource();
|
||||
// absolutely needs thread-bound DataSource to initialize
|
||||
@@ -79,7 +78,6 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
* This implementation delegates to the underlying DataSource.
|
||||
* @see javax.sql.DataSource#getConnection()
|
||||
*/
|
||||
@Override
|
||||
public Connection getConnection() throws SQLException {
|
||||
try {
|
||||
return this.dataSourceToUse.getConnection();
|
||||
@@ -94,7 +92,6 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
* This implementation calls {@link DataSourceUtils#doCloseConnection},
|
||||
* checking against a {@link org.springframework.jdbc.datasource.SmartDataSource}.
|
||||
*/
|
||||
@Override
|
||||
public void closeConnection(Connection con) throws SQLException {
|
||||
try {
|
||||
DataSourceUtils.doCloseConnection(con, this.dataSourceToUse);
|
||||
@@ -109,7 +106,6 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
* This implementation does nothing:
|
||||
* We're dealing with an externally managed DataSource.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
@@ -118,7 +114,6 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
* to receive the same Connection within a transaction, not even when
|
||||
* dealing with a JNDI DataSource.
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsAggressiveRelease() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,17 +70,14 @@ public class LocalRegionFactoryProxy implements RegionFactory {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void start(Settings settings, Properties properties) throws CacheException {
|
||||
this.regionFactory.start(settings, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
this.regionFactory.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMinimalPutsEnabledByDefault() {
|
||||
return this.regionFactory.isMinimalPutsEnabledByDefault();
|
||||
}
|
||||
@@ -95,33 +92,28 @@ public class LocalRegionFactoryProxy implements RegionFactory {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long nextTimestamp() {
|
||||
return this.regionFactory.nextTimestamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
|
||||
throws CacheException {
|
||||
|
||||
return this.regionFactory.buildEntityRegion(regionName, properties, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionRegion buildCollectionRegion(String regionName, Properties properties,
|
||||
CacheDataDescription metadata) throws CacheException {
|
||||
|
||||
return this.regionFactory.buildCollectionRegion(regionName, properties, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties)
|
||||
throws CacheException {
|
||||
|
||||
return this.regionFactory.buildQueryResultsRegion(regionName, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
|
||||
throws CacheException {
|
||||
|
||||
|
||||
@@ -540,7 +540,6 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
this.schemaUpdate = schemaUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
@@ -940,7 +939,6 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
hibernateTemplate.setFlushMode(HibernateTemplate.FLUSH_NEVER);
|
||||
hibernateTemplate.execute(
|
||||
new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException, SQLException {
|
||||
@SuppressWarnings("deprecation")
|
||||
Connection con = session.connection();
|
||||
@@ -986,7 +984,6 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
hibernateTemplate.setFlushMode(HibernateTemplate.FLUSH_NEVER);
|
||||
hibernateTemplate.execute(
|
||||
new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException, SQLException {
|
||||
@SuppressWarnings("deprecation")
|
||||
Connection con = session.connection();
|
||||
@@ -1024,7 +1021,6 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
|
||||
hibernateTemplate.execute(
|
||||
new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException, SQLException {
|
||||
@SuppressWarnings("deprecation")
|
||||
Connection con = session.connection();
|
||||
@@ -1062,7 +1058,6 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
|
||||
hibernateTemplate.execute(
|
||||
new HibernateCallback<Object>() {
|
||||
@Override
|
||||
public Object doInHibernate(Session session) throws HibernateException, SQLException {
|
||||
@SuppressWarnings("deprecation")
|
||||
Connection con = session.connection();
|
||||
|
||||
@@ -58,17 +58,14 @@ public class LocalTransactionManagerLookup implements TransactionManagerLookup {
|
||||
this.transactionManager = tm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionManager getTransactionManager(Properties props) {
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserTransactionName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTransactionIdentifier(Transaction transaction) {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ public class SpringSessionContext implements CurrentSessionContext {
|
||||
/**
|
||||
* Retrieve the Spring-managed Session for the current thread, if any.
|
||||
*/
|
||||
@Override
|
||||
public Session currentSession() throws HibernateException {
|
||||
try {
|
||||
return (org.hibernate.classic.Session) SessionFactoryUtils.doGetSession(this.sessionFactory, false);
|
||||
|
||||
@@ -106,12 +106,10 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return SessionFactoryUtils.SESSION_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspend() {
|
||||
if (this.holderActive) {
|
||||
TransactionSynchronizationManager.unbindResource(this.sessionFactory);
|
||||
@@ -120,14 +118,12 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
if (this.holderActive) {
|
||||
TransactionSynchronizationManager.bindResource(this.sessionFactory, this.sessionHolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
try {
|
||||
SessionFactoryUtils.logger.debug("Flushing Hibernate Session on explicit request");
|
||||
@@ -138,7 +134,6 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCommit(boolean readOnly) throws DataAccessException {
|
||||
if (!readOnly) {
|
||||
Session session = getCurrentSession();
|
||||
@@ -165,7 +160,6 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
return SessionFactoryUtils.convertHibernateAccessException(ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCompletion() {
|
||||
if (this.jtaTransaction != null) {
|
||||
// Typically in case of a suspended JTA transaction:
|
||||
@@ -220,11 +214,9 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
try {
|
||||
if (!this.hibernateTransactionCompletion || !this.newSession) {
|
||||
|
||||
@@ -46,31 +46,25 @@ public class SpringTransactionFactory implements TransactionFactory {
|
||||
* However, for Spring's resource management (in particular for
|
||||
* HibernateTransactionManager), "on_close" is the better default.
|
||||
*/
|
||||
@Override
|
||||
public ConnectionReleaseMode getDefaultReleaseMode() {
|
||||
return ConnectionReleaseMode.ON_CLOSE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction createTransaction(JDBCContext jdbcContext, Context transactionContext) {
|
||||
return new JDBCTransaction(jdbcContext, transactionContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Properties props) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransactionManagerRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areCallbacksLocalToHibernateTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransactionInProgress(
|
||||
JDBCContext jdbcContext, Context transactionContext, Transaction transaction) {
|
||||
|
||||
|
||||
@@ -111,14 +111,12 @@ public class TypeDefinitionBean implements BeanNameAware, InitializingBean {
|
||||
* the TypeDefinitionBean will be used.
|
||||
* @see #setTypeName
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
if (this.typeName == null) {
|
||||
this.typeName = name;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (this.typeName == null) {
|
||||
throw new IllegalArgumentException("typeName is required");
|
||||
|
||||
@@ -150,7 +150,6 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
this.entityTypeFilters = entityTypeFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns false.
|
||||
*/
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
@@ -96,7 +95,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
* This implementation delegates to the Hibernate EqualsHelper.
|
||||
* @see org.hibernate.util.EqualsHelper#equals
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
return EqualsHelper.equals(x, y);
|
||||
}
|
||||
@@ -104,7 +102,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns the hashCode of the given objectz.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
return x.hashCode();
|
||||
}
|
||||
@@ -112,7 +109,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns the passed-in value as-is.
|
||||
*/
|
||||
@Override
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
return value;
|
||||
}
|
||||
@@ -120,7 +116,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns the passed-in value as-is.
|
||||
*/
|
||||
@Override
|
||||
public Serializable disassemble(Object value) throws HibernateException {
|
||||
return (Serializable) value;
|
||||
}
|
||||
@@ -128,7 +123,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns the passed-in value as-is.
|
||||
*/
|
||||
@Override
|
||||
public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return cached;
|
||||
}
|
||||
@@ -136,7 +130,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns the passed-in original as-is.
|
||||
*/
|
||||
@Override
|
||||
public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
||||
return original;
|
||||
}
|
||||
@@ -147,7 +140,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
* passing in the LobHandler of this type.
|
||||
* @see #nullSafeGetInternal
|
||||
*/
|
||||
@Override
|
||||
public final Object nullSafeGet(ResultSet rs, String[] names, Object owner)
|
||||
throws HibernateException, SQLException {
|
||||
|
||||
@@ -170,7 +162,6 @@ public abstract class AbstractLobType implements UserType {
|
||||
* LobHandler of this type.
|
||||
* @see #nullSafeSetInternal
|
||||
*/
|
||||
@Override
|
||||
public final void nullSafeSet(PreparedStatement st, Object value, int index)
|
||||
throws HibernateException, SQLException {
|
||||
|
||||
|
||||
@@ -60,12 +60,10 @@ public class BlobByteArrayType extends AbstractLobType {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[] {Types.BLOB};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return byte[].class;
|
||||
}
|
||||
|
||||
@@ -76,12 +76,10 @@ public class BlobSerializableType extends AbstractLobType {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[] {Types.BLOB};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return Serializable.class;
|
||||
}
|
||||
|
||||
@@ -66,12 +66,10 @@ public class BlobStringType extends AbstractLobType {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[] {Types.BLOB};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@@ -62,12 +62,10 @@ public class ClobStringType extends AbstractLobType {
|
||||
super(lobHandler, jtaTransactionManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] sqlTypes() {
|
||||
return new int[] {Types.CLOB};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class returnedClass() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,6 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
* {@link TransactionSynchronizationManager}.
|
||||
* @see org.springframework.orm.hibernate3.SessionFactoryUtils#getSession
|
||||
*/
|
||||
@Override
|
||||
public void preHandle(WebRequest request) throws DataAccessException {
|
||||
|
||||
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
|
||||
@@ -190,7 +189,6 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
* assuming that service layer transactions have flushed their changes on commit.
|
||||
* @see #setFlushMode
|
||||
*/
|
||||
@Override
|
||||
public void postHandle(WebRequest request, ModelMap model) throws DataAccessException {
|
||||
if (isSingleSession()) {
|
||||
// Only potentially flush in single session mode.
|
||||
@@ -212,7 +210,6 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
* been opened during the current request (in deferred close mode).
|
||||
* @see org.springframework.transaction.support.TransactionSynchronizationManager
|
||||
*/
|
||||
@Override
|
||||
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
if (isSingleSession()) {
|
||||
@@ -229,7 +226,6 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConcurrentHandlingStarted(WebRequest request) {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
if (isSingleSession()) {
|
||||
|
||||
@@ -282,7 +282,6 @@ public class SqlMapClientFactoryBean implements FactoryBean<SqlMapClient>, Initi
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (this.lobHandler != null) {
|
||||
// Make given LobHandler available for SqlMapClient configuration.
|
||||
@@ -383,17 +382,14 @@ public class SqlMapClientFactoryBean implements FactoryBean<SqlMapClient>, Initi
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SqlMapClient getObject() {
|
||||
return this.sqlMapClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends SqlMapClient> getObjectType() {
|
||||
return (this.sqlMapClient != null ? this.sqlMapClient.getClass() : SqlMapClient.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -261,87 +261,73 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object queryForObject(String statementName) throws DataAccessException {
|
||||
return queryForObject(statementName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object queryForObject(final String statementName, final Object parameterObject)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Object>() {
|
||||
@Override
|
||||
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.queryForObject(statementName, parameterObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object queryForObject(
|
||||
final String statementName, final Object parameterObject, final Object resultObject)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Object>() {
|
||||
@Override
|
||||
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.queryForObject(statementName, parameterObject, resultObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List queryForList(String statementName) throws DataAccessException {
|
||||
return queryForList(statementName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List queryForList(final String statementName, final Object parameterObject)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<List>() {
|
||||
@Override
|
||||
public List doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.queryForList(statementName, parameterObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List queryForList(String statementName, int skipResults, int maxResults)
|
||||
throws DataAccessException {
|
||||
|
||||
return queryForList(statementName, null, skipResults, maxResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List queryForList(
|
||||
final String statementName, final Object parameterObject, final int skipResults, final int maxResults)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<List>() {
|
||||
@Override
|
||||
public List doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.queryForList(statementName, parameterObject, skipResults, maxResults);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryWithRowHandler(String statementName, RowHandler rowHandler)
|
||||
throws DataAccessException {
|
||||
|
||||
queryWithRowHandler(statementName, null, rowHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryWithRowHandler(
|
||||
final String statementName, final Object parameterObject, final RowHandler rowHandler)
|
||||
throws DataAccessException {
|
||||
|
||||
execute(new SqlMapClientCallback<Object>() {
|
||||
@Override
|
||||
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
executor.queryWithRowHandler(statementName, parameterObject, rowHandler);
|
||||
return null;
|
||||
@@ -349,67 +335,56 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map queryForMap(
|
||||
final String statementName, final Object parameterObject, final String keyProperty)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Map>() {
|
||||
@Override
|
||||
public Map doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.queryForMap(statementName, parameterObject, keyProperty);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map queryForMap(
|
||||
final String statementName, final Object parameterObject, final String keyProperty, final String valueProperty)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Map>() {
|
||||
@Override
|
||||
public Map doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.queryForMap(statementName, parameterObject, keyProperty, valueProperty);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object insert(String statementName) throws DataAccessException {
|
||||
return insert(statementName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object insert(final String statementName, final Object parameterObject)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Object>() {
|
||||
@Override
|
||||
public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.insert(statementName, parameterObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(String statementName) throws DataAccessException {
|
||||
return update(statementName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(final String statementName, final Object parameterObject)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Integer>() {
|
||||
@Override
|
||||
public Integer doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.update(statementName, parameterObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String statementName, Object parameterObject, int requiredRowsAffected)
|
||||
throws DataAccessException {
|
||||
|
||||
@@ -420,24 +395,20 @@ public class SqlMapClientTemplate extends JdbcAccessor implements SqlMapClientOp
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(String statementName) throws DataAccessException {
|
||||
return delete(statementName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(final String statementName, final Object parameterObject)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new SqlMapClientCallback<Integer>() {
|
||||
@Override
|
||||
public Integer doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
|
||||
return executor.delete(statementName, parameterObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String statementName, Object parameterObject, int requiredRowsAffected)
|
||||
throws DataAccessException {
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
|
||||
* LobHandler of this type.
|
||||
* @see #setParameterInternal
|
||||
*/
|
||||
@Override
|
||||
public final void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType)
|
||||
throws SQLException {
|
||||
|
||||
@@ -117,7 +116,6 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
|
||||
* @see #getResult(java.sql.ResultSet, String)
|
||||
* @see java.sql.ResultSet#findColumn
|
||||
*/
|
||||
@Override
|
||||
public final Object getResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return getResult(rs, rs.findColumn(columnName));
|
||||
}
|
||||
@@ -127,7 +125,6 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
|
||||
* passing in the LobHandler of this type.
|
||||
* @see #getResultInternal
|
||||
*/
|
||||
@Override
|
||||
public final Object getResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
try {
|
||||
return getResultInternal(rs, columnIndex, this.lobHandler);
|
||||
@@ -142,7 +139,6 @@ public abstract class AbstractLobTypeHandler extends BaseTypeHandler {
|
||||
* This implementation always throws a SQLException:
|
||||
* retrieving LOBs from a CallableStatement is not supported.
|
||||
*/
|
||||
@Override
|
||||
public Object getResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
throw new SQLException("Retrieving LOBs from a CallableStatement is not supported");
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ public class BlobByteArrayTypeHandler extends AbstractLobTypeHandler {
|
||||
return lobHandler.getBlobAsBytes(rs, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object valueOf(String s) {
|
||||
return s.getBytes();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,6 @@ public class BlobSerializableTypeHandler extends AbstractLobTypeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object valueOf(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ public class ClobStringTypeHandler extends AbstractLobTypeHandler {
|
||||
return lobHandler.getClobAsString(rs, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object valueOf(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* @see javax.jdo.Transaction#begin
|
||||
* @see org.springframework.transaction.InvalidIsolationLevelException
|
||||
*/
|
||||
@Override
|
||||
public Object beginTransaction(Transaction transaction, TransactionDefinition definition)
|
||||
throws JDOException, SQLException, TransactionException {
|
||||
|
||||
@@ -146,7 +145,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* does not require any cleanup.
|
||||
* @see #beginTransaction
|
||||
*/
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
}
|
||||
|
||||
@@ -171,7 +169,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* @see org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor
|
||||
* @see org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection
|
||||
*/
|
||||
@Override
|
||||
public ConnectionHandle getJdbcConnection(PersistenceManager pm, boolean readOnly)
|
||||
throws JDOException, SQLException {
|
||||
|
||||
@@ -186,7 +183,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* {@code Connection.close} here.
|
||||
* @see java.sql.Connection#close()
|
||||
*/
|
||||
@Override
|
||||
public void releaseJdbcConnection(ConnectionHandle conHandle, PersistenceManager pm)
|
||||
throws JDOException, SQLException {
|
||||
}
|
||||
@@ -197,7 +193,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* "javax.persistence.query.timeout", assuming that JDO providers are often
|
||||
* JPA providers as well.
|
||||
*/
|
||||
@Override
|
||||
public void applyQueryTimeout(Query query, int remainingTimeInSeconds) throws JDOException {
|
||||
if (setTimeoutMillisMethod != null) {
|
||||
ReflectionUtils.invokeMethod(setTimeoutMillisMethod, query, remainingTimeInSeconds);
|
||||
@@ -221,7 +216,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
|
||||
* @see #translateException
|
||||
*/
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
if (ex instanceof JDOException) {
|
||||
return translateException((JDOException) ex);
|
||||
@@ -233,7 +227,6 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* This implementation delegates to PersistenceManagerFactoryUtils.
|
||||
* @see PersistenceManagerFactoryUtils#convertJdoAccessException
|
||||
*/
|
||||
@Override
|
||||
public DataAccessException translateException(JDOException ex) {
|
||||
if (getJdbcExceptionTranslator() != null && ex.getCause() instanceof SQLException) {
|
||||
return getJdbcExceptionTranslator().translate("JDO operation: " + ex.getMessage(),
|
||||
@@ -269,12 +262,10 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
this.persistenceManager = persistenceManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
return (Connection) this.persistenceManager.getDataStoreConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseConnection(Connection con) {
|
||||
JdbcUtils.closeConnection(con);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ public abstract class JdoAccessor implements InitializingBean {
|
||||
* Eagerly initialize the JDO dialect, creating a default one
|
||||
* for the specified PersistenceManagerFactory if none set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getPersistenceManagerFactory() == null) {
|
||||
throw new IllegalArgumentException("Property 'persistenceManagerFactory' is required");
|
||||
|
||||
@@ -90,7 +90,6 @@ public class JdoInterceptor extends JdoAccessor implements MethodInterceptor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
boolean existingTransaction = false;
|
||||
PersistenceManager pm = PersistenceManagerFactoryUtils.getPersistenceManager(getPersistenceManagerFactory(), true);
|
||||
|
||||
@@ -175,12 +175,10 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T execute(JdoCallback<T> action) throws DataAccessException {
|
||||
return execute(action, isExposeNativePersistenceManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection executeFind(JdoCallback<?> action) throws DataAccessException {
|
||||
Object result = execute(action, isExposeNativePersistenceManager());
|
||||
if (result != null && !(result instanceof Collection)) {
|
||||
@@ -264,30 +262,24 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
// Convenience methods for load, save, delete
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Object getObjectById(final Object objectId) throws DataAccessException {
|
||||
return execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
return pm.getObjectById(objectId, true);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getObjectById(final Class<T> entityClass, final Object idValue) throws DataAccessException {
|
||||
return execute(new JdoCallback<T>() {
|
||||
@Override
|
||||
public T doInJdo(PersistenceManager pm) throws JDOException {
|
||||
return pm.getObjectById(entityClass, idValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(final Object entity) throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.evict(entity);
|
||||
return null;
|
||||
@@ -295,10 +287,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evictAll(final Collection entities) throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.evictAll(entities);
|
||||
return null;
|
||||
@@ -306,10 +296,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evictAll() throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.evictAll();
|
||||
return null;
|
||||
@@ -317,10 +305,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(final Object entity) throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.refresh(entity);
|
||||
return null;
|
||||
@@ -328,10 +314,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshAll(final Collection entities) throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.refreshAll(entities);
|
||||
return null;
|
||||
@@ -339,10 +323,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshAll() throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.refreshAll();
|
||||
return null;
|
||||
@@ -350,30 +332,24 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T makePersistent(final T entity) throws DataAccessException {
|
||||
return execute(new JdoCallback<T>() {
|
||||
@Override
|
||||
public T doInJdo(PersistenceManager pm) throws JDOException {
|
||||
return pm.makePersistent(entity);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> makePersistentAll(final Collection<T> entities) throws DataAccessException {
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
return pm.makePersistentAll(entities);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePersistent(final Object entity) throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.deletePersistent(entity);
|
||||
return null;
|
||||
@@ -381,10 +357,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePersistentAll(final Collection entities) throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.deletePersistentAll(entities);
|
||||
return null;
|
||||
@@ -392,30 +366,24 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T detachCopy(final T entity) {
|
||||
return execute(new JdoCallback<T>() {
|
||||
@Override
|
||||
public T doInJdo(PersistenceManager pm) throws JDOException {
|
||||
return pm.detachCopy(entity);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> detachCopyAll(final Collection<T> entities) {
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
return pm.detachCopyAll(entities);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws DataAccessException {
|
||||
execute(new JdoCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJdo(PersistenceManager pm) throws JDOException {
|
||||
pm.flush();
|
||||
return null;
|
||||
@@ -428,22 +396,18 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
// Convenience finder methods
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(Class<T> entityClass) throws DataAccessException {
|
||||
return find(entityClass, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(Class<T> entityClass, String filter) throws DataAccessException {
|
||||
return find(entityClass, filter, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(final Class<T> entityClass, final String filter, final String ordering)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = (filter != null ? pm.newQuery(entityClass, filter) : pm.newQuery(entityClass));
|
||||
@@ -456,20 +420,17 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(Class<T> entityClass, String filter, String parameters, Object... values)
|
||||
throws DataAccessException {
|
||||
|
||||
return find(entityClass, filter, parameters, values, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(
|
||||
final Class<T> entityClass, final String filter, final String parameters, final Object[] values,
|
||||
final String ordering) throws DataAccessException {
|
||||
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newQuery(entityClass, filter);
|
||||
@@ -483,7 +444,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(
|
||||
Class<T> entityClass, String filter, String parameters, Map<String, ?> values)
|
||||
throws DataAccessException {
|
||||
@@ -491,13 +451,11 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
return find(entityClass, filter, parameters, values, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> find(
|
||||
final Class<T> entityClass, final String filter, final String parameters,
|
||||
final Map<String, ?> values, final String ordering) throws DataAccessException {
|
||||
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newQuery(entityClass, filter);
|
||||
@@ -511,10 +469,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection find(final String language, final Object queryObject) throws DataAccessException {
|
||||
return execute(new JdoCallback<Collection>() {
|
||||
@Override
|
||||
public Collection doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newQuery(language, queryObject);
|
||||
prepareQuery(query);
|
||||
@@ -523,10 +479,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection find(final String queryString) throws DataAccessException {
|
||||
return execute(new JdoCallback<Collection>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newQuery(queryString);
|
||||
@@ -536,10 +490,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection find(final String queryString, final Object... values) throws DataAccessException {
|
||||
return execute(new JdoCallback<Collection>() {
|
||||
@Override
|
||||
public Collection doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newQuery(queryString);
|
||||
prepareQuery(query);
|
||||
@@ -548,10 +500,8 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection find(final String queryString, final Map<String, ?> values) throws DataAccessException {
|
||||
return execute(new JdoCallback<Collection>() {
|
||||
@Override
|
||||
public Collection doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newQuery(queryString);
|
||||
prepareQuery(query);
|
||||
@@ -560,12 +510,10 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> findByNamedQuery(final Class<T> entityClass, final String queryName)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newNamedQuery(entityClass, queryName);
|
||||
@@ -575,12 +523,10 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> findByNamedQuery(final Class<T> entityClass, final String queryName, final Object... values)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newNamedQuery(entityClass, queryName);
|
||||
@@ -590,13 +536,11 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Collection<T> findByNamedQuery(
|
||||
final Class<T> entityClass, final String queryName, final Map<String, ?> values)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new JdoCallback<Collection<T>>() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<T> doInJdo(PersistenceManager pm) throws JDOException {
|
||||
Query query = pm.newNamedQuery(entityClass, queryName);
|
||||
@@ -641,7 +585,6 @@ public class JdoTemplate extends JdoAccessor implements JdoOperations {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on PersistenceManager interface (or provider-specific extension) coming in...
|
||||
|
||||
|
||||
@@ -232,7 +232,6 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
* for the specified PersistenceManagerFactory if none set.
|
||||
* Auto-detect the PersistenceManagerFactory's DataSource, if any.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getPersistenceManagerFactory() == null) {
|
||||
throw new IllegalArgumentException("Property 'persistenceManagerFactory' is required");
|
||||
@@ -257,7 +256,6 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getResourceFactory() {
|
||||
return getPersistenceManagerFactory();
|
||||
}
|
||||
@@ -573,13 +571,11 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRollbackOnly() {
|
||||
Transaction tx = this.persistenceManagerHolder.getPersistenceManager().currentTransaction();
|
||||
return tx.getRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
try {
|
||||
this.persistenceManagerHolder.getPersistenceManager().flush();
|
||||
|
||||
@@ -196,7 +196,6 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
this.jdoDialect = jdoDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
@@ -208,7 +207,6 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
* @throws IOException if the properties could not be loaded from the given location
|
||||
* @throws JDOException in case of JDO initialization errors
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws IllegalArgumentException, IOException, JDOException {
|
||||
if (this.persistenceManagerFactoryName != null) {
|
||||
if (this.configLocation != null || !this.jdoPropertyMap.isEmpty()) {
|
||||
@@ -277,18 +275,15 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
/**
|
||||
* Return the singleton PersistenceManagerFactory.
|
||||
*/
|
||||
@Override
|
||||
public PersistenceManagerFactory getObject() {
|
||||
return this.persistenceManagerFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends PersistenceManagerFactory> getObjectType() {
|
||||
return (this.persistenceManagerFactory != null ?
|
||||
this.persistenceManagerFactory.getClass() : PersistenceManagerFactory.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -303,7 +298,6 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
* @see JdoDialect#translateException
|
||||
* @see PersistenceManagerFactoryUtils#convertJdoAccessException
|
||||
*/
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
if (ex instanceof JDOException) {
|
||||
if (this.jdoDialect != null) {
|
||||
@@ -320,7 +314,6 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
/**
|
||||
* Close the PersistenceManagerFactory on bean factory shutdown.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info("Closing JDO PersistenceManagerFactory");
|
||||
this.persistenceManagerFactory.close();
|
||||
|
||||
@@ -304,7 +304,6 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
this.newPersistenceManager = newPersistenceManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return PERSISTENCE_MANAGER_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@@ -122,17 +122,14 @@ public class TransactionAwarePersistenceManagerFactoryProxy implements FactoryBe
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceManagerFactory getObject() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends PersistenceManagerFactory> getObjectType() {
|
||||
return PersistenceManagerFactory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -145,7 +142,6 @@ public class TransactionAwarePersistenceManagerFactoryProxy implements FactoryBe
|
||||
*/
|
||||
private class PersistenceManagerFactoryInvocationHandler implements InvocationHandler {
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on PersistenceManagerFactory interface coming in...
|
||||
|
||||
@@ -192,7 +188,6 @@ public class TransactionAwarePersistenceManagerFactoryProxy implements FactoryBe
|
||||
this.persistenceManagerFactory = pmf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on PersistenceManager interface coming in...
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ public class OpenPersistenceManagerInViewInterceptor implements WebRequestInterc
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preHandle(WebRequest request) throws DataAccessException {
|
||||
if (TransactionSynchronizationManager.hasResource(getPersistenceManagerFactory())) {
|
||||
// Do not modify the PersistenceManager: just mark the request accordingly.
|
||||
@@ -107,11 +106,9 @@ public class OpenPersistenceManagerInViewInterceptor implements WebRequestInterc
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(WebRequest request, ModelMap model) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
|
||||
String participateAttributeName = getParticipateAttributeName();
|
||||
Integer count = (Integer) request.getAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
|
||||
|
||||
@@ -144,7 +144,6 @@ public class SpringPersistenceManagerProxyBean implements FactoryBean<Persistenc
|
||||
return this.allowCreate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getPersistenceManagerFactory() == null) {
|
||||
throw new IllegalArgumentException("Property 'persistenceManagerFactory' is required");
|
||||
@@ -159,17 +158,14 @@ public class SpringPersistenceManagerProxyBean implements FactoryBean<Persistenc
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceManager getObject() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends PersistenceManager> getObjectType() {
|
||||
return getPersistenceManagerInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -181,7 +177,6 @@ public class SpringPersistenceManagerProxyBean implements FactoryBean<Persistenc
|
||||
*/
|
||||
private class PersistenceManagerInvocationHandler implements InvocationHandler {
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on PersistenceManager interface coming in...
|
||||
|
||||
|
||||
@@ -57,17 +57,14 @@ public class StandardPersistenceManagerProxyBean implements FactoryBean<Persiste
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceManager getObject() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends PersistenceManager> getObjectType() {
|
||||
return (this.proxy != null ? this.proxy.getClass() : PersistenceManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.persistenceProvider = persistenceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
@@ -158,7 +157,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.persistenceUnitName = persistenceUnitName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceUnitName() {
|
||||
return this.persistenceUnitName;
|
||||
}
|
||||
@@ -225,7 +223,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.entityManagerInterface = emInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return this.entityManagerInterface;
|
||||
}
|
||||
@@ -241,7 +238,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.jpaDialect = jpaDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return this.jpaDialect;
|
||||
}
|
||||
@@ -264,28 +260,23 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
return this.jpaVendorAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getBeanClassLoader() {
|
||||
return this.beanClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
this.beanName = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() throws PersistenceException {
|
||||
if (this.jpaVendorAdapter != null) {
|
||||
if (this.persistenceProvider == null) {
|
||||
@@ -408,23 +399,19 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
* @see JpaDialect#translateExceptionIfPossible
|
||||
* @see EntityManagerFactoryUtils#convertJpaAccessExceptionIfPossible
|
||||
*/
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
return (this.jpaDialect != null ? this.jpaDialect.translateExceptionIfPossible(ex) :
|
||||
EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityManagerFactory getNativeEntityManagerFactory() {
|
||||
return this.nativeEntityManagerFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceUnitInfo getPersistenceUnitInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
return null;
|
||||
}
|
||||
@@ -433,17 +420,14 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
/**
|
||||
* Return the singleton EntityManagerFactory.
|
||||
*/
|
||||
@Override
|
||||
public EntityManagerFactory getObject() {
|
||||
return this.entityManagerFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManagerFactory> getObjectType() {
|
||||
return (this.entityManagerFactory != null ? this.entityManagerFactory.getClass() : EntityManagerFactory.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -452,7 +436,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
/**
|
||||
* Close the EntityManagerFactory on bean factory shutdown.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Closing JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'");
|
||||
@@ -516,7 +499,6 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.entityManagerFactoryBean = emfb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
try {
|
||||
if (method.getName().equals("equals")) {
|
||||
|
||||
@@ -60,7 +60,6 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* @see org.springframework.transaction.InvalidIsolationLevelException
|
||||
* @see #cleanupTransaction
|
||||
*/
|
||||
@Override
|
||||
public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition)
|
||||
throws PersistenceException, SQLException, TransactionException {
|
||||
|
||||
@@ -73,7 +72,6 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name)
|
||||
throws PersistenceException {
|
||||
|
||||
@@ -85,7 +83,6 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* implementation does not require any cleanup.
|
||||
* @see #beginTransaction
|
||||
*/
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
}
|
||||
|
||||
@@ -93,7 +90,6 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* This implementation always returns {@code null},
|
||||
* indicating that no JDBC Connection can be provided.
|
||||
*/
|
||||
@Override
|
||||
public ConnectionHandle getJdbcConnection(EntityManager entityManager, boolean readOnly)
|
||||
throws PersistenceException, SQLException {
|
||||
|
||||
@@ -108,7 +104,6 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* {@code Connection.close()} (or some other method with similar effect) here.
|
||||
* @see java.sql.Connection#close()
|
||||
*/
|
||||
@Override
|
||||
public void releaseJdbcConnection(ConnectionHandle conHandle, EntityManager em)
|
||||
throws PersistenceException, SQLException {
|
||||
}
|
||||
@@ -122,28 +117,23 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* This implementation delegates to EntityManagerFactoryUtils.
|
||||
* @see EntityManagerFactoryUtils#convertJpaAccessExceptionIfPossible
|
||||
*/
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
return EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean supportsEntityManagerFactoryPlusOperations() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsEntityManagerPlusOperations() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityManagerFactoryPlusOperations getEntityManagerFactoryPlusOperations(EntityManagerFactory rawEntityManager) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " does not support EntityManagerFactoryPlusOperations");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityManagerPlusOperations getEntityManagerPlusOperations(EntityManager rawEntityManager) {
|
||||
throw new UnsupportedOperationException(getClass().getName() + " does not support EntityManagerPlusOperations");
|
||||
}
|
||||
|
||||
@@ -129,7 +129,6 @@ public abstract class EntityManagerFactoryAccessor implements BeanFactoryAware {
|
||||
* Falls back to a default EntityManagerFactory bean if no persistence unit specified.
|
||||
* @see #setPersistenceUnitName
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (getEntityManagerFactory() == null) {
|
||||
if (!(beanFactory instanceof ListableBeanFactory)) {
|
||||
|
||||
@@ -372,7 +372,6 @@ public abstract class EntityManagerFactoryUtils {
|
||||
this.newEntityManager = newEm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return ENTITY_MANAGER_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,6 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on EntityManager interface coming in...
|
||||
|
||||
@@ -453,7 +452,6 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
this.exceptionTranslator = exceptionTranslator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return EntityManagerFactoryUtils.ENTITY_MANAGER_SYNCHRONIZATION_ORDER + 1;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,6 @@ public abstract class JpaAccessor extends EntityManagerFactoryAccessor implement
|
||||
* Eagerly initialize the JPA dialect, creating a default one
|
||||
* for the specified EntityManagerFactory if none set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
EntityManagerFactory emf = getEntityManagerFactory();
|
||||
if (emf == null && getEntityManager() == null) {
|
||||
|
||||
@@ -85,7 +85,6 @@ public class JpaInterceptor extends JpaAccessor implements MethodInterceptor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
// Determine current EntityManager: either the transactional one
|
||||
// managed by the factory or a temporary one for the given invocation.
|
||||
|
||||
@@ -146,12 +146,10 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T execute(JpaCallback<T> action) throws DataAccessException {
|
||||
return execute(action, isExposeNativeEntityManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List executeFind(JpaCallback<?> action) throws DataAccessException {
|
||||
Object result = execute(action, isExposeNativeEntityManager());
|
||||
if (!(result instanceof List)) {
|
||||
@@ -231,40 +229,32 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
// Convenience methods for load, save, delete
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public <T> T find(final Class<T> entityClass, final Object id) throws DataAccessException {
|
||||
return execute(new JpaCallback<T>() {
|
||||
@Override
|
||||
public T doInJpa(EntityManager em) throws PersistenceException {
|
||||
return em.find(entityClass, id);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getReference(final Class<T> entityClass, final Object id) throws DataAccessException {
|
||||
return execute(new JpaCallback<T>() {
|
||||
@Override
|
||||
public T doInJpa(EntityManager em) throws PersistenceException {
|
||||
return em.getReference(entityClass, id);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(final Object entity) throws DataAccessException {
|
||||
return execute(new JpaCallback<Boolean>() {
|
||||
@Override
|
||||
public Boolean doInJpa(EntityManager em) throws PersistenceException {
|
||||
return em.contains(entity);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(final Object entity) throws DataAccessException {
|
||||
execute(new JpaCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJpa(EntityManager em) throws PersistenceException {
|
||||
em.refresh(entity);
|
||||
return null;
|
||||
@@ -272,10 +262,8 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(final Object entity) throws DataAccessException {
|
||||
execute(new JpaCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJpa(EntityManager em) throws PersistenceException {
|
||||
em.persist(entity);
|
||||
return null;
|
||||
@@ -283,20 +271,16 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T merge(final T entity) throws DataAccessException {
|
||||
return execute(new JpaCallback<T>() {
|
||||
@Override
|
||||
public T doInJpa(EntityManager em) throws PersistenceException {
|
||||
return em.merge(entity);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(final Object entity) throws DataAccessException {
|
||||
execute(new JpaCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJpa(EntityManager em) throws PersistenceException {
|
||||
em.remove(entity);
|
||||
return null;
|
||||
@@ -304,10 +288,8 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws DataAccessException {
|
||||
execute(new JpaCallback<Object>() {
|
||||
@Override
|
||||
public Object doInJpa(EntityManager em) throws PersistenceException {
|
||||
em.flush();
|
||||
return null;
|
||||
@@ -320,15 +302,12 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
// Convenience finder methods
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public List find(String queryString) throws DataAccessException {
|
||||
return find(queryString, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List find(final String queryString, final Object... values) throws DataAccessException {
|
||||
return execute(new JpaCallback<List>() {
|
||||
@Override
|
||||
public List doInJpa(EntityManager em) throws PersistenceException {
|
||||
Query queryObject = em.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -342,10 +321,8 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedParams(final String queryString, final Map<String, ?> params) throws DataAccessException {
|
||||
return execute(new JpaCallback<List>() {
|
||||
@Override
|
||||
public List doInJpa(EntityManager em) throws PersistenceException {
|
||||
Query queryObject = em.createQuery(queryString);
|
||||
prepareQuery(queryObject);
|
||||
@@ -359,15 +336,12 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQuery(String queryName) throws DataAccessException {
|
||||
return findByNamedQuery(queryName, (Object[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQuery(final String queryName, final Object... values) throws DataAccessException {
|
||||
return execute(new JpaCallback<List>() {
|
||||
@Override
|
||||
public List doInJpa(EntityManager em) throws PersistenceException {
|
||||
Query queryObject = em.createNamedQuery(queryName);
|
||||
prepareQuery(queryObject);
|
||||
@@ -381,12 +355,10 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List findByNamedQueryAndNamedParams(final String queryName, final Map<String, ?> params)
|
||||
throws DataAccessException {
|
||||
|
||||
return execute(new JpaCallback<List>() {
|
||||
@Override
|
||||
public List doInJpa(EntityManager em) throws PersistenceException {
|
||||
Query queryObject = em.createNamedQuery(queryName);
|
||||
prepareQuery(queryObject);
|
||||
@@ -436,7 +408,6 @@ public class JpaTemplate extends JpaAccessor implements JpaOperations {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on EntityManager interface (or provider-specific extension) coming in...
|
||||
|
||||
|
||||
@@ -282,7 +282,6 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* Falls back to a default EntityManagerFactory bean if no persistence unit specified.
|
||||
* @see #setPersistenceUnitName
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (getEntityManagerFactory() == null) {
|
||||
if (!(beanFactory instanceof ListableBeanFactory)) {
|
||||
@@ -299,7 +298,6 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* for the specified EntityManagerFactory if none set.
|
||||
* Auto-detect the EntityManagerFactory's DataSource, if any.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getEntityManagerFactory() == null) {
|
||||
throw new IllegalArgumentException("'entityManagerFactory' or 'persistenceUnitName' is required");
|
||||
@@ -318,7 +316,6 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getResourceFactory() {
|
||||
return getEntityManagerFactory();
|
||||
}
|
||||
@@ -656,13 +653,11 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRollbackOnly() {
|
||||
EntityTransaction tx = this.entityManagerHolder.getEntityManager().getTransaction();
|
||||
return tx.getRollbackOnly();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
try {
|
||||
this.entityManagerHolder.getEntityManager().flush();
|
||||
|
||||
@@ -240,12 +240,10 @@ public class LocalContainerEntityManagerFactoryBean extends AbstractEntityManage
|
||||
* @see org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
|
||||
* @see org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
|
||||
*/
|
||||
@Override
|
||||
public void setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver) {
|
||||
this.internalPersistenceUnitManager.setLoadTimeWeaver(loadTimeWeaver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.internalPersistenceUnitManager.setResourceLoader(resourceLoader);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,6 @@ public abstract class SharedEntityManagerCreator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on EntityManager interface coming in...
|
||||
|
||||
@@ -288,7 +287,6 @@ public abstract class SharedEntityManagerCreator {
|
||||
this.em = em;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on Query interface coming in...
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ class ClassFileTransformerAdapter implements ClassFileTransformer {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] transform(
|
||||
ClassLoader loader, String className, Class<?> classBeingRedefined,
|
||||
ProtectionDomain protectionDomain, byte[] classfileBuffer) {
|
||||
|
||||
@@ -322,7 +322,6 @@ public class DefaultPersistenceUnitManager
|
||||
* @see org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
|
||||
* @see org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
|
||||
*/
|
||||
@Override
|
||||
public void setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver) {
|
||||
this.loadTimeWeaver = loadTimeWeaver;
|
||||
}
|
||||
@@ -335,13 +334,11 @@ public class DefaultPersistenceUnitManager
|
||||
return this.loadTimeWeaver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (this.loadTimeWeaver == null && InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
|
||||
this.loadTimeWeaver = new InstrumentationLoadTimeWeaver(this.resourcePatternResolver.getClassLoader());
|
||||
@@ -545,7 +542,6 @@ public class DefaultPersistenceUnitManager
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo() {
|
||||
if (this.persistenceUnitInfoNames.isEmpty()) {
|
||||
throw new IllegalStateException("No persistence units parsed from " +
|
||||
@@ -563,7 +559,6 @@ public class DefaultPersistenceUnitManager
|
||||
return pui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName) {
|
||||
PersistenceUnitInfo pui = this.persistenceUnitInfos.remove(persistenceUnitName);
|
||||
if (pui == null) {
|
||||
@@ -611,7 +606,6 @@ public class DefaultPersistenceUnitManager
|
||||
return this.target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (method.getName().equals("getSharedCacheMode")) {
|
||||
return Enum.valueOf(this.sharedCacheModeEnum, this.target.getSharedCacheModeName());
|
||||
|
||||
@@ -72,7 +72,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceUnitName = persistenceUnitName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceUnitName() {
|
||||
return this.persistenceUnitName;
|
||||
}
|
||||
@@ -81,7 +80,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceProviderClassName = persistenceProviderClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderClassName() {
|
||||
return this.persistenceProviderClassName;
|
||||
}
|
||||
@@ -90,7 +88,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.transactionType = transactionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceUnitTransactionType getTransactionType() {
|
||||
if (this.transactionType != null) {
|
||||
return this.transactionType;
|
||||
@@ -105,7 +102,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.jtaDataSource = jtaDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getJtaDataSource() {
|
||||
return this.jtaDataSource;
|
||||
}
|
||||
@@ -114,7 +110,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.nonJtaDataSource = nonJtaDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getNonJtaDataSource() {
|
||||
return this.nonJtaDataSource;
|
||||
}
|
||||
@@ -123,7 +118,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.mappingFileNames.add(mappingFileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMappingFileNames() {
|
||||
return this.mappingFileNames;
|
||||
}
|
||||
@@ -132,7 +126,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.jarFileUrls.add(jarFileUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<URL> getJarFileUrls() {
|
||||
return this.jarFileUrls;
|
||||
}
|
||||
@@ -141,7 +134,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceUnitRootUrl = persistenceUnitRootUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getPersistenceUnitRootUrl() {
|
||||
return this.persistenceUnitRootUrl;
|
||||
}
|
||||
@@ -150,7 +142,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.managedClassNames.add(managedClassName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getManagedClassNames() {
|
||||
return this.managedClassNames;
|
||||
}
|
||||
@@ -159,7 +150,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.excludeUnlistedClasses = excludeUnlistedClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean excludeUnlistedClasses() {
|
||||
return this.excludeUnlistedClasses;
|
||||
}
|
||||
@@ -175,7 +165,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
@@ -188,7 +177,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
return this.persistenceXMLSchemaVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistenceProviderPackageName(String persistenceProviderPackageName) {
|
||||
this.persistenceProviderPackageName = persistenceProviderPackageName;
|
||||
}
|
||||
@@ -202,7 +190,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
* This implementation returns the default ClassLoader.
|
||||
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return ClassUtils.getDefaultClassLoader();
|
||||
}
|
||||
@@ -210,7 +197,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
/**
|
||||
* This implementation throws an UnsupportedOperationException.
|
||||
*/
|
||||
@Override
|
||||
public void addTransformer(ClassTransformer classTransformer) {
|
||||
throw new UnsupportedOperationException("addTransformer not supported");
|
||||
}
|
||||
@@ -218,7 +204,6 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
/**
|
||||
* This implementation throws an UnsupportedOperationException.
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getNewTempClassLoader() {
|
||||
throw new UnsupportedOperationException("getNewTempClassLoader not supported");
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
|
||||
public static final String PARTICIPATE_SUFFIX = ".PARTICIPATE";
|
||||
|
||||
|
||||
@Override
|
||||
public void preHandle(WebRequest request) throws DataAccessException {
|
||||
|
||||
String participateAttributeName = getParticipateAttributeName();
|
||||
@@ -107,11 +106,9 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(WebRequest request, ModelMap model) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
EntityManagerHolder emHolder = (EntityManagerHolder)
|
||||
@@ -137,7 +134,6 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConcurrentHandlingStarted(WebRequest request) {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
|
||||
|
||||
@@ -306,12 +306,10 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ListableBeanFactory) {
|
||||
this.beanFactory = (ListableBeanFactory) beanFactory;
|
||||
@@ -319,7 +317,6 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
|
||||
if (beanType != null) {
|
||||
InjectionMetadata metadata = findPersistenceMetadata(beanType);
|
||||
@@ -327,17 +324,14 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyValues postProcessPropertyValues(
|
||||
PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
|
||||
|
||||
@@ -351,17 +345,14 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
return pvs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
|
||||
EntityManager emToClose = this.extendedEntityManagersToClose.remove(bean);
|
||||
EntityManagerFactoryUtils.closeEntityManager(emToClose);
|
||||
|
||||
@@ -73,7 +73,6 @@ public class SharedEntityManagerBean extends EntityManagerFactoryAccessor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() {
|
||||
EntityManagerFactory emf = getEntityManagerFactory();
|
||||
if (emf == null) {
|
||||
@@ -106,17 +105,14 @@ public class SharedEntityManagerBean extends EntityManagerFactoryAccessor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EntityManager getObject() {
|
||||
return this.shared;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getObjectType() {
|
||||
return (this.entityManagerInterface != null ? this.entityManagerInterface : EntityManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,27 +110,22 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderRootPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ?> getJpaPropertyMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface() {
|
||||
return EntityManagerFactory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return EntityManager.class;
|
||||
}
|
||||
@@ -139,7 +134,6 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
|
||||
* Post-process the EntityManagerFactory after it has been initialized.
|
||||
* @param emf the EntityManagerFactory to process
|
||||
*/
|
||||
@Override
|
||||
public void postProcessEntityManagerFactory(EntityManagerFactory emf) {
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final JpaDialect jpaDialect = new EclipseLinkJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,6 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
try {
|
||||
if (connectionMethod == null) {
|
||||
@@ -167,7 +166,6 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseConnection(Connection con) {
|
||||
JdbcUtils.closeConnection(con);
|
||||
}
|
||||
|
||||
@@ -39,19 +39,16 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class HibernateJpaSessionFactoryBean extends EntityManagerFactoryAccessor implements FactoryBean<SessionFactory> {
|
||||
|
||||
@Override
|
||||
public SessionFactory getObject() {
|
||||
EntityManagerFactory emf = getEntityManagerFactory();
|
||||
Assert.isInstanceOf(HibernateEntityManagerFactory.class, emf);
|
||||
return ((HibernateEntityManagerFactory) emf).getSessionFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SessionFactory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final JpaDialect jpaDialect = new HibernateJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createSavepoint() throws TransactionException {
|
||||
this.savepointCounter++;
|
||||
String savepointName = ConnectionHolder.SAVEPOINT_NAME_PREFIX + this.savepointCounter;
|
||||
@@ -96,12 +95,10 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
return savepointName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollbackToSavepoint(Object savepoint) throws TransactionException {
|
||||
this.entityManager.rollbackToSavepoint((String) savepoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseSavepoint(Object savepoint) throws TransactionException {
|
||||
this.entityManager.releaseSavepoint((String) savepoint);
|
||||
}
|
||||
@@ -123,12 +120,10 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
return (Connection) this.entityManager.getConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseConnection(Connection con) {
|
||||
JdbcUtils.closeConnection(con);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final OpenJpaDialect jpaDialect = new OpenJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ public class TopLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final JpaDialect jpaDialect = new TopLinkJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user