users@glassfish.java.net

Re: em.flush() doesn't work

From: Wolfram Rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Fri, 29 May 2009 16:49:13 +0200

glassfish_at_javadesktop.org wrote:
> I use NB 6.5.1, glassfish 2.1, EJB 3, Toplink persistence to MySQL. Project logic is servlet triggers EJB, then EJB to process and em.persist (myobject) to DB. The program works. But all my rows in DB are readable by MySQL client only after the program finished all records. During the execution, SELECT returns empty. I've tried to add em.flush() after em.persist(myobject), but still the same. Why flush() doesn't flush the dirty ones to DB? Any thing I need to set in the persistance unit xml or in MySQL?
> [Message sent by forum member 'senderj' (senderj)]

To understand this correctly: Are you using a long-running transaction?

If so, the answer is that JPA uses READ_COMMITTED as the lowest possible
isolation level. Thus no dirty reads are possible (though other problems
might occur).


--
Wolfram Rittmeyer