Add @Override annotations to main sources

Issue: SPR-10130
This commit is contained in:
Chris Beams
2012-12-28 14:00:16 +01:00
parent 9c2046c3ee
commit 3b40ce76bf
1256 changed files with 5716 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ import org.springframework.dao.support.PersistenceExceptionTranslator;
*/
public class HibernateExceptionTranslator implements PersistenceExceptionTranslator {
@Override
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
if (ex instanceof HibernateException) {
return convertHibernateAccessException((HibernateException) ex);

View File

@@ -242,6 +242,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
this.hibernateManagedSession = hibernateManagedSession;
}
@Override
public void afterPropertiesSet() {
if (getSessionFactory() == null) {
throw new IllegalArgumentException("Property 'sessionFactory' is required");
@@ -262,6 +263,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
}
@Override
public Object getResourceFactory() {
return getSessionFactory();
}
@@ -652,6 +654,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
}
}
@Override
public boolean isRollbackOnly() {
return this.sessionHolder.isRollbackOnly() ||
(hasConnectionHolder() && getConnectionHolder().isRollbackOnly());

View File

@@ -268,11 +268,13 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
this.jtaTransactionManager = jtaTransactionManager;
}
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
@Override
public void afterPropertiesSet() throws IOException {
LocalSessionFactoryBuilder sfb = new LocalSessionFactoryBuilder(this.dataSource, this.resourcePatternResolver);
@@ -385,19 +387,23 @@ public class LocalSessionFactoryBean extends HibernateExceptionTranslator
}
@Override
public SessionFactory getObject() {
return this.sessionFactory;
}
@Override
public Class<?> getObjectType() {
return (this.sessionFactory != null ? this.sessionFactory.getClass() : SessionFactory.class);
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public void destroy() {
this.sessionFactory.close();
}

View File

@@ -62,6 +62,7 @@ public class SpringSessionContext implements CurrentSessionContext {
/**
* Retrieve the Spring-managed Session for the current thread, if any.
*/
@Override
public Session currentSession() throws HibernateException {
Object value = TransactionSynchronizationManager.getResource(this.sessionFactory);
if (value instanceof Session) {

View File

@@ -52,10 +52,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);
@@ -64,12 +66,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");
@@ -80,6 +84,7 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
}
}
@Override
public void beforeCommit(boolean readOnly) throws DataAccessException {
if (!readOnly) {
Session session = getCurrentSession();
@@ -97,6 +102,7 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
}
}
@Override
public void beforeCompletion() {
Session session = this.sessionHolder.getSession();
if (this.sessionHolder.getPreviousFlushMode() != null) {
@@ -107,9 +113,11 @@ class SpringSessionSynchronization implements TransactionSynchronization, Ordere
session.disconnect();
}
@Override
public void afterCommit() {
}
@Override
public void afterCompletion(int status) {
try {
if (status != STATUS_COMMITTED) {

View File

@@ -95,6 +95,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
* {@code HibernateAccessor} and bind it to the thread via the
* {@link org.springframework.transaction.support.TransactionSynchronizationManager}.
*/
@Override
public void preHandle(WebRequest request) throws DataAccessException {
String participateAttributeName = getParticipateAttributeName();
@@ -123,6 +124,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
}
}
@Override
public void postHandle(WebRequest request, ModelMap model) {
}
@@ -130,6 +132,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
* Unbind the Hibernate {@code Session} from the thread and close it).
* @see org.springframework.transaction.support.TransactionSynchronizationManager
*/
@Override
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
if (!decrementParticipateCount(request)) {
SessionHolder sessionHolder =
@@ -156,6 +159,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
return true;
}
@Override
public void afterConcurrentHandlingStarted(WebRequest request) {
if (!decrementParticipateCount(request)) {
TransactionSynchronizationManager.unbindResource(getSessionFactory());