users@glassfish.java.net

Re: entityManager.persist and JMS messaging issue

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Fri, 6 Feb 2009 07:21:12 +0100

you can try flush to force the persistence, and also include
try{}catch for the runtime exception that may occur before the
notification..........

On Thu, Feb 5, 2009 at 11:21 PM, <glassfish_at_javadesktop.org> wrote:
> Hi everyone:
>
> I am seeing a problem that I could not figure out a solution. Can anyone shed me some lights on this?
>
> I have a EJB method which basically does 2 things: 1). persists a record into a database table using EntityManager 2). sends out a message to a JMS topic. So it is sth like:
>
> myMethod() {
> entityManager.persist(myObj);
> notifier.notify(...);
> }
>
> The client will then listen to the JMS topic and read the new record from database. Usually this works pretty well, but sometimes, the client cannot find the new record from database at all and a few seconds later it can. It is as if there is a delay between the JMS messaging and database persistence - somehow the client receives the message first and at this time the record is not really saved into database yet!
>
> Can anyone explain to me what is going on here? What kind of solutions might help to resolve this?
>
> BTW, I am using the Hibernate EntityManager and my app server is Glassfish.
>
> Thanks a lot for your help
>
> jmao
> [Message sent by forum member 'jmao' (jmao)]
>
> http://forums.java.net/jive/thread.jspa?messageID=330425
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>