Hi Asaf,
I'm just thinking here, so I might be wrong.
Can you look up a container-managed EMF (or it's not available yet at the time
you are creating the logging facilities)? If you can't, you should be able to
use Persistence.createEMF. In any case, you'll probably need to use
RESOURCE_LOCAL EM and the EntityTransaction to mark the transaction boundaries,
so that your data does not depend on the status of the global transaction.
Please also note that a) EM is not thread safe,, and b) an app-managed EM has an
EXTENDED persistence context by default, so unless you want to remember the
previous entires in the persistence context, you'll need to either have 1 EM per
each entry or call em.clear() after each et.commit().
HTH,
-marina
glassfish_at_javadesktop.org wrote:
> Hey,
>
> I'd like to use java util's logging facilities but with a new handler that persist entities,
>
> What is the correct and most efficient way to load/create an entity manager into a logging handler?
>
> Since the logger being invoked many times, I'd like to know the most efficient way to do this,
>
>
> Thanks in advanced,
>
> Asaf.
> [Message sent by forum member 'trouby' (trouby)]
>
> http://forums.java.net/jive/thread.jspa?messageID=208778
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>