[jboss-user] [EJB 3.0] - DDL statement inside a transaction (mysql)
vanyatka
do-not-reply at jboss.com
Mon Aug 18 13:12:26 EDT 2008
Hi,
There is a transactional SLSB method that uses EntityManager.
It does some business logic, and on its finish all DB changes should be made persistent or rolled back.
The problem is that along the way some DDL statements must also be executed. And MySQL cannot execute those statements inside the same SQL transaction, forcing to commit all outstanding changes.
http://dev.mysql.com/doc/refman/5.0/en/implicit-commit.html
I tried to workaround the problem, issuing DLL statements inside a new transaction, like this:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
| public int ddl(String ddl) {
| log.warn("DDL is #0", ddl);
| return entityManager.createNativeQuery(ddl).executeUpdate();
| }
|
But in spite of REQUIRES_NEW attribute all previous changes of *parent* transaction are also made persistent.
Can you suggest what might be the problem?
Thanks,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171107#4171107
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171107
More information about the jboss-user
mailing list