users@glassfish.java.net

Re: How to clear EntityManager when transaction commits?

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Thu, 31 Jul 2008 15:51:14 -0700

By default container managed EntityManager is transaction scoped. Which
implies that at end of transaction all entities will become and detached
and you need not call clear explicitly. Refer to section 5.6 of
persistence spec for details.

glassfish_at_javadesktop.org wrote:
> Hi,
>
> I have a basic question concerning EntityManager and it's clear() method. I'm not sure if this method is called automatically when (container managed) transaction commits. I think it should be, cause without it entities persisted in the transaction can't be garbage collected (assuming that 2nd level cache is disabled). Or maybe in other words - when can entities persisted in a transaction be detached from persistence context and garbage collected - still assuming that 2nd level cache is disabled.
>
> Thanks,
> Olaf Tomczak
> [Message sent by forum member 'olafos' (olafos)]
>
> http://forums.java.net/jive/thread.jspa?messageID=290634
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>