tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexis KRIER <bym_...@hotmail.com>
Subject can't persist value in TransactionSynchronizationRegistry
Date Thu, 12 Apr 2012 16:15:38 GMT

Hello all I have an entityManagerProvider wich creates the entityManager if it does not exist
already.

To do this I store the EntityManager created in TransactionSynchronizationRegistry 
 TransactionSynchronizationRegistry registry = (TransactionSynchronizationRegistry)getContext().lookup(
          "java:comp/TransactionSynchronizationRegistry");
(works also with java:openejb)

then when an other call is done to the EMProvider I look in the registry to get my manager
if it exists:
TransactionSynchronizationRegistry registry = (TransactionSynchronizationRegistry)getContext().lookup(
          "java:comp/TransactionSynchronizationRegistry");
registry.getesources("The key")

The problem is that on each call from a stateless resource, it seem that the registry is always
empty...

By the way the registry.put("My entity") is working well because when I do immediately after
a get I can see My value stored.

Is there a trick to keep the TransactionSynchronizationRegistry Statefull?

thank you

Alexis
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message