Is it possible to set a diffrent value then 'auto' to the hibernate propery - "connection.release_mode"?
We use Spring with hibernate, When I try to define in this propery - 'after_transaction' (When i define hibernate properties in session factory definition), In runtime i get an exception (Spring exception) that the only valid value (in Spring terms) for this prop is 'on_close'. This fact cause us many troubles. We use the session-per-request pattern (meaning " a client sends a request to the server, where the Hibernate persistence layer is running. Hibernate opens a new Session, and all database operations are executed in this unit of work."(hibernate doc ). when on_close is defined - connection is being allocate per service (there is not re-use of connections).
We use HibernateTransactionManager to manage transactions in combination with TransactionInterceptor. We handle sessions with AnnotationSessionFactoryBean (our session factory) , I try to define in the session factory decleration in the "hibernateProperties" part - > connection.release_mode=after_transaction. In Runtime when server try loading session factory I got this exception :
org.springframework.transaction.InvalidIsolationLevelException: HibernateTransactionManager is not allowed to support custom isolation levels: make sure that its 'prepareConnection' flag is on (the default) and that the Hibernate connection release mode is set to 'on_close' (SpringTransactionFactory's default). Make sure that your LocalSessionFactoryBean actually uses SpringTransactionFactory: Your Hibernate properties should *not* include a 'hibernate.transaction.factory_class' property!
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:515)
... 121 more
Why spring do that? and is there a bypass
any advice would be appreciated.