Back Forum Reply New

Support vendor-specific flush mode quot;neverquot; in JpaDialects

Hi,
I am using Spring 2.5 with JPA support and trying to declare a method with read only transaction. According to API spring changes the flushmode of the underlying persistent provider into quot;NEVERquot;. As shown in the code below when I checked it, its value had NOT changed (remains as quot;AUTOquot;)

I'm using JTA as transaction manager with WebLogic 11g and Hibernate as persistence provider .

@Transactional(propagation=Propagation.REQUIRED, readOnly=true)
public Listlt;Accountgt; getAccountsByIdJdbcPagination(int startIndex,
int maxResults, String[] args)

and execute something like
getJpaTemplate().execute(new JpaCallback() {
public Object doInJpa(EntityManager em) { em.getFlushMode(); // Shows quot;AUTOquot; when debugged return null;
}
});My entity manager declaration

lt;bean id=quot;entityManagerFactoryquot;
class=quot;org..orm.jpa.LocalContainerE  ntityManagerFactoryBeanquot;gt;
lt;property name=quot;dataSourcequot;gt;
lt;ref bean=quot;jndiDataSourcequot; /gt;
lt;/propertygt;
lt;property name=quot;persistenceXmlLocationquot; value=quot;META-INF/persistence-jee.xmlquot; /gt;
lt;property name=quot;jpaVendorAdapterquot;gt;
lt;bean class=quot;org..orm.jpa.vendor.Hibernat  eJpaVendorAdapterquot;gt;
lt;property name=quot;databasequot; value=quot;ORACLEquot; /gt;
lt;property name=quot;showSqlquot; value=quot;${persistance.showSql}quot; /gt;
lt;property name=quot;generateDdlquot; value=quot;falsequot; /gt;
lt;property name=quot;databasePlatformquot; value=quot;org.hibernate.dialect.OracleDialectquot; /gt;
lt;/beangt;
lt;/propertygt;
lt;/beangt;

And persistence.xml properties

lt;property name=quot;hibernate.dialectquot; value=quot;org.hibernate.dialect.OracleDialectquot;/gt;
lt;property name=quot;hibernate.connection.driver_classquot; value=quot;oracle.jdbc.driver.OracleDriverquot;/gt;
lt;property name=quot;hibernate.transaction.manager_lookup_classquot; value=quot;org.hibernate.transaction.WeblogicTransacti  onManagerLookupquot;/gt;lt;!-- property name=quot;transaction.factory_classquot; value=quot;org.hibernate.transaction.JTATransactionFac  toryquot;/--gt;lt;property name=quot;hibernate.query.factory_classquot; value=quot;org.hibernate.hql.classic.ClassicQueryTrans  latorFactoryquot;/gt;

Have I understood spring's functionality here wrong or have I made a mistake in the implementation.
Any Ideas?

Thanks
Sandaruwan
¥
Back Forum Reply New