| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Base class for HibernateTemplate and HibernateInterceptor, defining common properties like flushing behavior.
Not intended to be used directly. See HibernateTemplate and HibernateInterceptor.
| Field Summary | |
final static int | FLUSH_AUTOAutomatic flushing is the default mode for a Hibernate session. |
final static int | FLUSH_EAGEREager flushing leads to immediate synchronization with the database, even if in a transaction. |
final static int | FLUSH_NEVERNever flush is a good strategy for read-only units of work. |
| Method Summary | |
void | afterPropertiesSet() |
DataAccessException | convertHibernateAccessException(HibernateException ex)Convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy. |
void | flushIfNecessary(Session session, boolean existingTransaction)Flush the given Hibernate session if necessary. |
Interceptor | getEntityInterceptor()Return the current Hibernate entity interceptor, or null if none. |
int | getFlushMode()Return if a flush should be forced after executing the callback code. |
SQLExceptionTranslator | getJdbcExceptionTranslator()Return the JDBC exception translator for this instance. |
SessionFactory | getSessionFactory()Return the Hibernate SessionFactory that should be used to create Hibernate Sessions. |
void | setEntityInterceptor(Interceptor entityInterceptor)Set a Hibernate entity interceptor that allows to inspect and change property values before writing to and reading from the database. |
void | setFlushMode(int flushMode)Set the flush behavior to one of the constants in this class. |
void | setFlushModeName(String constantName)Set the flush behavior by the name of the respective constant in this class, e.g. |
void | setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)Set the JDBC exception translator for this instance. |
void | setSessionFactory(SessionFactory sessionFactory)Set the Hibernate SessionFactory that should be used to create Hibernate Sessions. |
| Field Detail |
public final static int FLUSH_AUTO
public final static int FLUSH_EAGER
public final static int FLUSH_NEVER
| Method Detail |
public void afterPropertiesSet()
public DataAccessException convertHibernateAccessException(HibernateException ex)
The default implementation delegates to SessionFactoryUtils and convertJdbcAccessException. Can be overridden in subclasses.
public void flushIfNecessary(Session session, boolean existingTransaction)
throws HibernateException
public Interceptor getEntityInterceptor()
public int getFlushMode()
public SQLExceptionTranslator getJdbcExceptionTranslator()
public SessionFactory getSessionFactory()
public void setEntityInterceptor(Interceptor entityInterceptor)
Such an interceptor can either be set at the SessionFactory level, i.e. on LocalSessionFactoryBean, or at the Session level, i.e. on HibernateTemplate, HibernateInterceptor, and HibernateTransactionManager. It's preferable to set it on LocalSessionFactoryBean or HibernateTransactionManager to avoid repeated configuration and guarantee consistent behavior in transactions.
public void setFlushMode(int flushMode)
public void setFlushModeName(String constantName)
public void setJdbcExceptionTranslator(SQLExceptionTranslator jdbcExceptionTranslator)
The default exception translator evaluates the exception's SQLState.
public void setSessionFactory(SessionFactory sessionFactory)
| Association Links |
to Class org.springframework.jdbc.support.SQLExceptionTranslator
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||