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(); }