users@glassfish.java.net

why em.persist() immediately inserts data into database?

From: <glassfish_at_javadesktop.org>
Date: Fri, 25 Jun 2010 07:26:04 PDT

use hibernate.
auto commit is off, I checked the hibernate logging.

code is like this:

try{
tx.begin();
em.persist(entity);
tx.commit();
}catch(Exception ex)
{
tx.rollabck();
}

after em.persist() is executed, the data is in my database! tx.commit() seems to be useless here.

Can anyone help me with that please ?
[Message sent by forum member 'bobxu']

http://forums.java.net/jive/thread.jspa?messageID=475823