users@glassfish.java.net

Re: Delivery of JMS message in case of distributed transaction

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 23 Jun 2009 16:04:39 -0700

Can it be that there is caching involved, and the cache is not yet updated by
the time the transaction commits?

Does MDB share the same PU as the component that creates an entity?

thanks,
-marina

glassfish_at_javadesktop.org wrote:
> Hi there, I am experiencing the same issue. I'm Using JPA [hibernate], Glassfish, Spring and i have an MDB.
>
> 1] I create a persistent object @Entity, call create [and call entitymanager.flush() even...]
> 2] I then retrieve the DB generated primary key and put it in the message and put it on the Queue.
> 3] The async MDB fires and receives the message
> 4] The ID is retrieved from the message and uses hibernate to load the object by id.
> 5] Once i have the object i do some updates on it and call merge.
>
> All seems ok until i exit onMessage(). 100% of the time i get an optimisitc lock exception on the object, the first time the message is processed. The message is redelivered after an interval and its process correctly without error the 2nd time. I can confirm that i have put @version on an Integer, not a date that loses precision etc...
>
> Any suggestions would be apreciated. This is proving very difficult to resolve.
> [Message sent by forum member 'gregjh' (gregjh)]
>
> http://forums.java.net/jive/thread.jspa?messageID=352466
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>