[
http://jira.jboss.com/jira/browse/JBSEAM-1745?page=comments#action_12400508 ]
Darryl Smith commented on JBSEAM-1745:
--------------------------------------
I can't remember why i was using HibernateJpaDialect before.
But what I had was
public class SeamHibernateJpaDialect extends HibernateJpaDialect {
@Override
protected Session getSession( EntityManager em ) {
return ( Session ) em.getDelegate();
}
}
I've been using DefaultJpaDialect since i've created this issue, with no issues.
So, I am not sure of the usefulness of using HibernateJpaDialect....
Maybe, there shouldn't be any code changes, but something added to the docs about not
using HibernateJpaDialect
SpringTransaction fails with HibernateJpaDialect and FlushMode.MANUAL
----------------------------------------------------------------------
Key: JBSEAM-1745
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1745
Project: JBoss Seam
Issue Type: Bug
Components: Spring
Reporter: Darryl Smith
Assigned To: Michael Youngstrom
When using flushMode = MANUAL with
org.springframework.orm.jpa.vendor.HibernateJpaDialect, the flushMode is changed to AUTO
when beginning transaction
SessionImpl.setFlushMode(FlushMode) line: 1286
HibernateSessionProxy.setFlushMode(FlushMode) line: 381
SeamHibernateJpaDialect(HibernateJpaDialect).beginTransaction(EntityManager,
TransactionDefinition) line: 60
JpaTransactionManager.doBegin(Object, TransactionDefinition) line: 326
JpaTransactionManager(AbstractPlatformTransactionManager).getTransaction(TransactionDefinition)
line: 350
SpringTransaction.begin() line: 74
Unless the transaction definition is set to readOnly spring will change the flushMode to
manual
HibernateJpaDialect:45
--------------------------------
public Object beginTransaction(EntityManager entityManager, TransactionDefinition
definition)
throws PersistenceException, SQLException, TransactionException {
super.beginTransaction(entityManager, definition);
Session session = getSession(entityManager);
FlushMode flushMode = session.getFlushMode();
FlushMode previousFlushMode = null;
if (definition.isReadOnly()) {
// We should suppress flushing for a read-only transaction.
session.setFlushMode(FlushMode.MANUAL);
previousFlushMode = flushMode;
}
else {
// We need AUTO or COMMIT for a non-read-only transaction.
if (flushMode.lessThan(FlushMode.COMMIT)) {
session.setFlushMode(FlushMode.AUTO);
previousFlushMode = flushMode;
}
}
return new SessionTransactionData(session, previousFlushMode);
}
Perhaps SpringTransaction should set should pass readOnly transaction def to Spring when
the flushMode is manual.
Current Workaround: use DefaultJpaDialect
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira