Add @Override to remaining source files
Issue: SPR-10130
This commit is contained in:
@@ -184,6 +184,7 @@ public abstract class AbstractSessionFactoryBean extends HibernateExceptionTrans
|
||||
* @see #buildSessionFactory()
|
||||
* @see #wrapSessionFactoryIfNecessary
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
SessionFactory rawSf = buildSessionFactory();
|
||||
this.sessionFactory = wrapSessionFactoryIfNecessary(rawSf);
|
||||
@@ -219,6 +220,7 @@ 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 {
|
||||
@@ -233,14 +235,17 @@ 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;
|
||||
}
|
||||
|
||||
@@ -111,26 +111,31 @@ 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,10 +305,12 @@ 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,6 +63,7 @@ public class HibernateExceptionTranslator implements PersistenceExceptionTransla
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
if (ex instanceof HibernateException) {
|
||||
return convertHibernateAccessException((HibernateException) ex);
|
||||
|
||||
@@ -86,6 +86,7 @@ public class HibernateInterceptor extends HibernateAccessor implements MethodInt
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
Session session = getSession();
|
||||
SessionHolder sessionHolder =
|
||||
|
||||
@@ -335,10 +335,12 @@ 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)) {
|
||||
@@ -502,14 +504,17 @@ 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) {
|
||||
@@ -522,14 +527,17 @@ 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);
|
||||
@@ -541,14 +549,17 @@ 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) {
|
||||
@@ -561,14 +572,17 @@ 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);
|
||||
@@ -580,8 +594,10 @@ 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);
|
||||
@@ -592,8 +608,10 @@ 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;
|
||||
@@ -601,12 +619,15 @@ 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);
|
||||
@@ -619,16 +640,20 @@ 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;
|
||||
@@ -636,6 +661,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Object proxy) throws DataAccessException {
|
||||
try {
|
||||
Hibernate.initialize(proxy);
|
||||
@@ -645,6 +671,7 @@ 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);
|
||||
@@ -659,8 +686,10 @@ 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;
|
||||
@@ -668,10 +697,12 @@ 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;
|
||||
@@ -679,8 +710,10 @@ 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);
|
||||
@@ -688,8 +721,10 @@ 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);
|
||||
@@ -697,12 +732,15 @@ 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);
|
||||
@@ -714,14 +752,17 @@ 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);
|
||||
@@ -733,8 +774,10 @@ 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);
|
||||
@@ -743,8 +786,10 @@ 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);
|
||||
@@ -753,10 +798,12 @@ 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);
|
||||
@@ -765,10 +812,12 @@ 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);
|
||||
@@ -777,8 +826,10 @@ 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);
|
||||
@@ -787,8 +838,10 @@ 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);
|
||||
@@ -797,8 +850,10 @@ 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);
|
||||
@@ -807,8 +862,10 @@ 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);
|
||||
@@ -817,12 +874,15 @@ 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) {
|
||||
@@ -834,14 +894,17 @@ 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) {
|
||||
@@ -853,8 +916,10 @@ 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) {
|
||||
@@ -865,8 +930,10 @@ 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;
|
||||
@@ -874,8 +941,10 @@ 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;
|
||||
@@ -888,16 +957,20 @@ 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);
|
||||
@@ -911,12 +984,14 @@ 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 {
|
||||
|
||||
@@ -924,6 +999,7 @@ 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);
|
||||
@@ -937,10 +1013,12 @@ 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);
|
||||
@@ -955,16 +1033,20 @@ 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);
|
||||
@@ -978,12 +1060,14 @@ 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 {
|
||||
@@ -992,6 +1076,7 @@ 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);
|
||||
@@ -1005,10 +1090,12 @@ 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);
|
||||
@@ -1023,15 +1110,18 @@ 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);
|
||||
@@ -1046,24 +1136,29 @@ 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()));
|
||||
@@ -1085,16 +1180,20 @@ 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);
|
||||
@@ -1108,6 +1207,7 @@ public class HibernateTemplate extends HibernateAccessor implements HibernateOpe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeIterator(Iterator it) throws DataAccessException {
|
||||
try {
|
||||
Hibernate.close(it);
|
||||
@@ -1117,16 +1217,20 @@ 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);
|
||||
@@ -1249,6 +1353,7 @@ 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,10 +395,12 @@ 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");
|
||||
@@ -422,6 +424,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getResourceFactory() {
|
||||
return getSessionFactory();
|
||||
}
|
||||
@@ -882,6 +885,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRollbackOnly() {
|
||||
return this.sessionHolder.isRollbackOnly() ||
|
||||
(hasConnectionHolder() && getConnectionHolder().isRollbackOnly());
|
||||
|
||||
@@ -44,6 +44,7 @@ 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
|
||||
@@ -78,6 +79,7 @@ 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();
|
||||
@@ -92,6 +94,7 @@ 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);
|
||||
@@ -106,6 +109,7 @@ public class LocalDataSourceConnectionProvider implements ConnectionProvider {
|
||||
* This implementation does nothing:
|
||||
* We're dealing with an externally managed DataSource.
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
@@ -114,6 +118,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -67,44 +67,53 @@ 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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getDefaultAccessType() {
|
||||
return this.regionFactory.getDefaultAccessType();
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
|
||||
@@ -506,6 +506,7 @@ public class LocalSessionFactoryBean extends AbstractSessionFactoryBean implemen
|
||||
this.schemaUpdate = schemaUpdate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
@@ -882,6 +883,7 @@ 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();
|
||||
@@ -927,6 +929,7 @@ 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();
|
||||
@@ -964,6 +967,7 @@ 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();
|
||||
@@ -1001,6 +1005,7 @@ 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,14 +58,17 @@ 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,6 +56,7 @@ 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,10 +106,12 @@ 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);
|
||||
@@ -118,12 +120,14 @@ 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");
|
||||
@@ -134,6 +138,7 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCommit(boolean readOnly) throws DataAccessException {
|
||||
if (!readOnly) {
|
||||
Session session = getCurrentSession();
|
||||
@@ -160,6 +165,7 @@ 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:
|
||||
@@ -214,9 +220,11 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(int status) {
|
||||
try {
|
||||
if (!this.hibernateTransactionCompletion || !this.newSession) {
|
||||
|
||||
@@ -46,25 +46,31 @@ 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,12 +111,14 @@ 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");
|
||||
|
||||
@@ -137,6 +137,7 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
|
||||
this.entityTypeFilters = entityTypeFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceLoader(ResourceLoader resourceLoader) {
|
||||
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public abstract class AbstractLobType implements UserType {
|
||||
/**
|
||||
* This implementation returns false.
|
||||
*/
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
@@ -95,6 +96,7 @@ 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);
|
||||
}
|
||||
@@ -102,6 +104,7 @@ 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();
|
||||
}
|
||||
@@ -109,6 +112,7 @@ 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;
|
||||
}
|
||||
@@ -116,6 +120,7 @@ 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;
|
||||
}
|
||||
@@ -123,6 +128,7 @@ 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;
|
||||
}
|
||||
@@ -130,6 +136,7 @@ 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;
|
||||
}
|
||||
@@ -140,6 +147,7 @@ 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 {
|
||||
|
||||
@@ -162,6 +170,7 @@ 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,10 +60,12 @@ 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,10 +76,12 @@ 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,10 +66,12 @@ 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,10 +62,12 @@ 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,6 +144,7 @@ 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);
|
||||
@@ -189,6 +190,7 @@ 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.
|
||||
@@ -210,6 +212,7 @@ 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()) {
|
||||
@@ -226,6 +229,7 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConcurrentHandlingStarted(WebRequest request) {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
if (isSingleSession()) {
|
||||
|
||||
@@ -112,6 +112,7 @@ 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 {
|
||||
|
||||
@@ -155,6 +156,7 @@ public class DefaultJdoDialect implements JdoDialect, PersistenceExceptionTransl
|
||||
* does not require any cleanup.
|
||||
* @see #beginTransaction
|
||||
*/
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
}
|
||||
|
||||
@@ -175,6 +177,7 @@ 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 {
|
||||
|
||||
@@ -189,6 +192,7 @@ 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 {
|
||||
}
|
||||
@@ -206,6 +210,7 @@ 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);
|
||||
@@ -217,6 +222,7 @@ 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(),
|
||||
@@ -252,10 +258,12 @@ 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);
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ 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");
|
||||
@@ -255,6 +256,7 @@ public class JdoTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getResourceFactory() {
|
||||
return getPersistenceManagerFactory();
|
||||
}
|
||||
@@ -570,11 +572,13 @@ 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();
|
||||
|
||||
@@ -195,6 +195,7 @@ public class LocalPersistenceManagerFactoryBean implements FactoryBean<Persisten
|
||||
this.jdoDialect = jdoDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
@@ -206,6 +207,7 @@ 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()) {
|
||||
@@ -274,15 +276,18 @@ 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;
|
||||
}
|
||||
@@ -297,6 +302,7 @@ 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) {
|
||||
@@ -313,6 +319,7 @@ 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();
|
||||
|
||||
@@ -300,6 +300,7 @@ public abstract class PersistenceManagerFactoryUtils {
|
||||
this.newPersistenceManager = newPersistenceManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return PERSISTENCE_MANAGER_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
|
||||
@@ -116,14 +116,17 @@ 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;
|
||||
}
|
||||
@@ -136,6 +139,7 @@ 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...
|
||||
|
||||
@@ -182,6 +186,7 @@ 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...
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ 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.
|
||||
@@ -103,9 +104,11 @@ 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);
|
||||
|
||||
@@ -141,6 +141,7 @@ public class SpringPersistenceManagerProxyBean implements FactoryBean<Persistenc
|
||||
return this.allowCreate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (getPersistenceManagerFactory() == null) {
|
||||
throw new IllegalArgumentException("Property 'persistenceManagerFactory' is required");
|
||||
@@ -155,14 +156,17 @@ 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;
|
||||
}
|
||||
@@ -174,6 +178,7 @@ 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...
|
||||
|
||||
|
||||
@@ -55,14 +55,17 @@ 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;
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.persistenceProvider = persistenceProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
@@ -155,6 +156,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.persistenceUnitName = persistenceUnitName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceUnitName() {
|
||||
return this.persistenceUnitName;
|
||||
}
|
||||
@@ -221,6 +223,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.entityManagerInterface = emInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntityManager> getEntityManagerInterface() {
|
||||
return this.entityManagerInterface;
|
||||
}
|
||||
@@ -236,6 +239,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
this.jpaDialect = jpaDialect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaDialect getJpaDialect() {
|
||||
return this.jpaDialect;
|
||||
}
|
||||
@@ -258,23 +262,28 @@ 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) {
|
||||
@@ -402,19 +411,23 @@ 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;
|
||||
}
|
||||
@@ -423,14 +436,17 @@ 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;
|
||||
}
|
||||
@@ -439,6 +455,7 @@ 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() + "'");
|
||||
@@ -502,6 +519,7 @@ 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")) {
|
||||
|
||||
@@ -55,6 +55,7 @@ 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 {
|
||||
|
||||
@@ -67,6 +68,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object prepareTransaction(EntityManager entityManager, boolean readOnly, String name)
|
||||
throws PersistenceException {
|
||||
|
||||
@@ -78,6 +80,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* implementation does not require any cleanup.
|
||||
* @see #beginTransaction
|
||||
*/
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
}
|
||||
|
||||
@@ -85,6 +88,7 @@ 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 {
|
||||
|
||||
@@ -99,6 +103,7 @@ 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 {
|
||||
}
|
||||
@@ -112,6 +117,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* This implementation delegates to EntityManagerFactoryUtils.
|
||||
* @see EntityManagerFactoryUtils#convertJpaAccessExceptionIfPossible
|
||||
*/
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
return EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(ex);
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ 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)) {
|
||||
|
||||
@@ -457,6 +457,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
this.newEntityManager = newEm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return ENTITY_MANAGER_SYNCHRONIZATION_ORDER;
|
||||
}
|
||||
@@ -518,6 +519,7 @@ public abstract class EntityManagerFactoryUtils {
|
||||
super(emHolder, emf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return ENTITY_MANAGER_SYNCHRONIZATION_ORDER + 1;
|
||||
}
|
||||
|
||||
@@ -267,6 +267,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on EntityManager interface coming in...
|
||||
|
||||
@@ -418,6 +419,7 @@ public abstract class ExtendedEntityManagerCreator {
|
||||
this.exceptionTranslator = exceptionTranslator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return EntityManagerFactoryUtils.ENTITY_MANAGER_SYNCHRONIZATION_ORDER - 1;
|
||||
}
|
||||
|
||||
@@ -281,6 +281,7 @@ 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)) {
|
||||
@@ -297,6 +298,7 @@ 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");
|
||||
@@ -315,6 +317,7 @@ public class JpaTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getResourceFactory() {
|
||||
return getEntityManagerFactory();
|
||||
}
|
||||
@@ -654,11 +657,13 @@ 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();
|
||||
|
||||
@@ -242,10 +242,12 @@ 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);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ public abstract class SharedEntityManagerCreator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on EntityManager interface coming in...
|
||||
|
||||
@@ -297,6 +298,7 @@ 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,6 +48,7 @@ class ClassFileTransformerAdapter implements ClassFileTransformer {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public byte[] transform(
|
||||
ClassLoader loader, String className, Class<?> classBeingRedefined,
|
||||
ProtectionDomain protectionDomain, byte[] classfileBuffer) {
|
||||
|
||||
@@ -317,6 +317,7 @@ 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;
|
||||
}
|
||||
@@ -329,11 +330,13 @@ 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());
|
||||
@@ -524,6 +527,7 @@ public class DefaultPersistenceUnitManager
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo() {
|
||||
if (this.persistenceUnitInfoNames.isEmpty()) {
|
||||
throw new IllegalStateException("No persistence units parsed from " +
|
||||
@@ -541,6 +545,7 @@ public class DefaultPersistenceUnitManager
|
||||
return pui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName) {
|
||||
PersistenceUnitInfo pui = this.persistenceUnitInfos.remove(persistenceUnitName);
|
||||
if (pui == null) {
|
||||
|
||||
@@ -78,6 +78,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceUnitName = persistenceUnitName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceUnitName() {
|
||||
return this.persistenceUnitName;
|
||||
}
|
||||
@@ -86,6 +87,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceProviderClassName = persistenceProviderClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceProviderClassName() {
|
||||
return this.persistenceProviderClassName;
|
||||
}
|
||||
@@ -94,6 +96,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.transactionType = transactionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceUnitTransactionType getTransactionType() {
|
||||
if (this.transactionType != null) {
|
||||
return this.transactionType;
|
||||
@@ -108,6 +111,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.jtaDataSource = jtaDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getJtaDataSource() {
|
||||
return this.jtaDataSource;
|
||||
}
|
||||
@@ -116,6 +120,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.nonJtaDataSource = nonJtaDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getNonJtaDataSource() {
|
||||
return this.nonJtaDataSource;
|
||||
}
|
||||
@@ -124,6 +129,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.mappingFileNames.add(mappingFileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMappingFileNames() {
|
||||
return this.mappingFileNames;
|
||||
}
|
||||
@@ -132,6 +138,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.jarFileUrls.add(jarFileUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<URL> getJarFileUrls() {
|
||||
return this.jarFileUrls;
|
||||
}
|
||||
@@ -140,6 +147,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceUnitRootUrl = persistenceUnitRootUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getPersistenceUnitRootUrl() {
|
||||
return this.persistenceUnitRootUrl;
|
||||
}
|
||||
@@ -148,6 +156,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.managedClassNames.add(managedClassName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getManagedClassNames() {
|
||||
return this.managedClassNames;
|
||||
}
|
||||
@@ -156,6 +165,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.excludeUnlistedClasses = excludeUnlistedClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean excludeUnlistedClasses() {
|
||||
return this.excludeUnlistedClasses;
|
||||
}
|
||||
@@ -164,6 +174,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.sharedCacheMode = sharedCacheMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedCacheMode getSharedCacheMode() {
|
||||
return this.sharedCacheMode;
|
||||
}
|
||||
@@ -172,6 +183,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.validationMode = validationMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationMode getValidationMode() {
|
||||
return this.validationMode;
|
||||
}
|
||||
@@ -187,6 +199,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Properties getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
@@ -195,10 +208,12 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
this.persistenceXMLSchemaVersion = persistenceXMLSchemaVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPersistenceXMLSchemaVersion() {
|
||||
return this.persistenceXMLSchemaVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistenceProviderPackageName(String persistenceProviderPackageName) {
|
||||
this.persistenceProviderPackageName = persistenceProviderPackageName;
|
||||
}
|
||||
@@ -212,6 +227,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
* This implementation returns the default ClassLoader.
|
||||
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return ClassUtils.getDefaultClassLoader();
|
||||
}
|
||||
@@ -219,6 +235,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
/**
|
||||
* This implementation throws an UnsupportedOperationException.
|
||||
*/
|
||||
@Override
|
||||
public void addTransformer(ClassTransformer classTransformer) {
|
||||
throw new UnsupportedOperationException("addTransformer not supported");
|
||||
}
|
||||
@@ -226,6 +243,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
|
||||
/**
|
||||
* This implementation throws an UnsupportedOperationException.
|
||||
*/
|
||||
@Override
|
||||
public ClassLoader getNewTempClassLoader() {
|
||||
throw new UnsupportedOperationException("getNewTempClassLoader not supported");
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
|
||||
public static final String PARTICIPATE_SUFFIX = ".PARTICIPATE";
|
||||
|
||||
|
||||
@Override
|
||||
public void preHandle(WebRequest request) throws DataAccessException {
|
||||
|
||||
String participateAttributeName = getParticipateAttributeName();
|
||||
@@ -101,9 +102,11 @@ 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)
|
||||
@@ -129,6 +132,7 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConcurrentHandlingStarted(WebRequest request) {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
|
||||
|
||||
@@ -312,10 +312,12 @@ 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;
|
||||
@@ -323,6 +325,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) {
|
||||
if (beanType != null) {
|
||||
InjectionMetadata metadata = findPersistenceMetadata(beanType);
|
||||
@@ -330,14 +333,17 @@ 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,14 +357,17 @@ 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);
|
||||
|
||||
@@ -81,6 +81,7 @@ public class SharedEntityManagerBean extends EntityManagerFactoryAccessor
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() {
|
||||
EntityManagerFactory emf = getEntityManagerFactory();
|
||||
if (emf == null) {
|
||||
@@ -105,14 +106,17 @@ 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,22 +110,27 @@ 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;
|
||||
}
|
||||
@@ -134,6 +139,7 @@ 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) {
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final JpaDialect jpaDialect = new EclipseLinkJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
try {
|
||||
if (connectionMethodToUse == null) {
|
||||
@@ -156,6 +157,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseConnection(Connection con) {
|
||||
if (sessionConnectionMethod != null) {
|
||||
// Need to explicitly call close() with Hibernate 3.x in order to allow
|
||||
|
||||
@@ -39,16 +39,19 @@ 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,6 +59,7 @@ public class HibernateJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final JpaDialect jpaDialect = new HibernateJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class OpenJpaDialect extends DefaultJpaDialect {
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createSavepoint() throws TransactionException {
|
||||
this.savepointCounter++;
|
||||
String savepointName = ConnectionHolder.SAVEPOINT_NAME_PREFIX + this.savepointCounter;
|
||||
@@ -95,10 +96,12 @@ 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);
|
||||
}
|
||||
@@ -120,10 +123,12 @@ 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,6 +48,7 @@ public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
|
||||
private final OpenJpaDialect jpaDialect = new OpenJpaDialect();
|
||||
|
||||
|
||||
@Override
|
||||
public PersistenceProvider getPersistenceProvider() {
|
||||
return this.persistenceProvider;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user