RE: Glassfish Shutdown with JPA
I have a timer that goes through a list of objects, performs an action on it, logs the object, sets a boolean, and persists it back to the database. The boolean indicates that the object is finished and should not be acted on again. So I have the following sudo loop:
list objects = get object from the database
while (more objects) {
act on object
log the object
set boolean
persist object
}
I had a list size of 1152 the other day and during the loop I shut down the server. After I started the server back up I noticed that it was logging the same objects again. I checked the logs and saw that all the actions and persistence happened as it should have but the DB simply was not reflecting the boolean indicator properly though I know it was set and persisted.
So it appears that the objects were simply not transfered from the cache to the DB. I am using EJB 3 with toplink.
-------- Original Message --------
Subject: Re: Glassfish Shutdown with JPA
From: Mitesh Meswani <Mitesh.Meswani@Sun.COM>
Date: Wed, October 15, 2008 2:19 pm
To: persistence@glassfish.dev.java.net
Can you please give some more details on what do you mean by "does not
appear to be saving the JPA persisted objects before shutdown.". Objects
saved using em.persist() will be saved to database at each transaction
completion. There is nothing special you will need to do.
-Mitesh
Dru Devore wrote:
> I have an application which does not appear to be saving the JPA
> persisted objects before shutdown.
>
> Yes, the objects are being persisted before the shutdown but it
> appears that they are not making it out of the cache. Is there
> something I have to do during shutdown of the application server to
> ensure the objects are actually stored.
>
>