hi, consider hibernate-link and JTA as peristence provider. How can I force em not to flush anything, and to handle it by myself?
@Stateless
public class SomeBean{
@PersistenceContext
EntityManager em;
public void method(){
em.persist(entity); // will get managed
em.clear(); // everything gets unmanaged
}
}
I would expect that there is nothing flushed into the database, but there is as I can see in the mysql shell. So how can I force EntityManager
not to flush anything after persist?
Thanks
persistence.xml
for completeness
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="pu" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence
<jta-data-source>jdbc/fotbalDataSource
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>