users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: clarification needed regarding EntityManager pooling in J2EE environment

From: Christian Romberg <cromberg_at_versant.com>
Date: Mon, 14 May 2012 10:21:30 +0200

Hi Mike,

I agree, if I were up to implement that part in an app server, I also would
not pool EMs.

However given the fact, that I can't influence the behavior of the app
server, and if we find out, that the app server
does not restore the properties, then we propably need to introduce a
workaround-switch in our implementation
like "versant.resetPropertiesOnClear".

Regards,

Christian

On Fri, May 11, 2012 at 10:48 PM, michael keith <michael.keith_at_oracle.com>wrote:

> Hi Christian,
>
> Well, that's up to the container, but I suppose it would have to query the
> properties and save the initial values, then reset back to the default ones
> when reassigning. I wouldn't actually recommend doing it, since EM's are
> supposed to be lightweight.
>
> -Mike
>
>
> On 11/05/2012 9:35 AM, Christian Romberg wrote:
>
> Hi Mike,
>
> How should the app server reinitialize the entity manager instance then?
>
> Regards,
>
> Christian
>
> On Fri, May 11, 2012 at 3:22 PM, michael keith <michael.keith_at_oracle.com>wrote:
>
>> Hi Christian,
>>
>> The clear() method was not intended to reinitialize the EM, but is just a
>> method that causes all of the entities in the persistence context to be
>> detached. You can actually see an example on page 300 that highlights this
>> fact. The footnote you reference was just making reference to the fact that
>> a clear() call would need to be made on the EM in order for it to be
>> reused. It was not intended to be a complete description of how to reuse an
>> EM, or of other issues that might also need to be handled. I admit that it
>> could be a bit misleading, though...
>>
>> Regards,
>> -Mike
>>
>>
>> On 10/05/2012 9:58 AM, Christian Romberg wrote:
>>
>> Dear group,
>>
>> The spec (2.0) says, p.304, section 7.9.1, footnote 79:
>>
>> "The container may choose to pool EntityManagers: it instead of creating
>> and closing in each case, it may acquire one from its pool
>> and call clear() on it."
>>
>> What should happen with any property settings that were changed by the
>> user?
>> E.g. setFlushMode or any vendor-specific properties?
>>
>> Should clear() also reset them to the values configured for the
>> EntityManagerFactory?
>>
>> I think this would make sense to get a clean, reusable EntityManager.
>>
>> And if this is the common understanding of how clear() should work, I
>> suggest that we add
>> that in the spec.
>>
>> Thank you!
>>
>> Christian
>>
>> --
>> Christian Romberg
>> Chief Engineer | Versant GmbH
>> (T) +49 40 60990-0
>> (F) +49 40 60990-113 <%2B49%2040%2060990-113>
>> (E) cromberg_at_versant.com
>> www.versant.com<http://www.google.com/url?q=http%3A%2F%2Fwww.versant.com%2F&sa=D&sntz=1&usg=AFrqEzeeEBc_gN_8mxtt8xDB0tjXDXQVlw>|
>> www.db4o.com<http://www.google.com/url?q=http%3A%2F%2Fwww.db4o.com%2F&sa=D&sntz=1&usg=AFrqEzdo3Q40RwKQPBtnPIuBYQd1diFxJQ>
>>
>> --
>> Versant
>> GmbH is incorporated in Germany. Company registration number: HRB
>> 54723, Amtsgericht Hamburg. Registered Office: Halenreie 42, 22359
>> Hamburg, Germany. Geschäftsführer: Bernhard Wöbker, Volker John
>>
>> CONFIDENTIALITY
>> NOTICE: This e-mail message, including any attachments, is for the sole
>> use of the intended recipient(s) and may contain confidential or
>> proprietary information. Any unauthorized review, use, disclosure or
>> distribution is prohibited. If you are not the intended recipient,
>> immediately contact the sender by reply e-mail and destroy all copies of
>> the original message.
>>
>>
>>
>>
>
>
> --
> Christian Romberg
> Chief Engineer | Versant GmbH
> (T) +49 40 60990-0
> (F) +49 40 60990-113
> (E) cromberg_at_versant.com
> www.versant.com<http://www.google.com/url?q=http%3A%2F%2Fwww.versant.com%2F&sa=D&sntz=1&usg=AFrqEzeeEBc_gN_8mxtt8xDB0tjXDXQVlw>|
> www.db4o.com<http://www.google.com/url?q=http%3A%2F%2Fwww.db4o.com%2F&sa=D&sntz=1&usg=AFrqEzdo3Q40RwKQPBtnPIuBYQd1diFxJQ>
>
> --
> Versant
> GmbH is incorporated in Germany. Company registration number: HRB
> 54723, Amtsgericht Hamburg. Registered Office: Halenreie 42, 22359
> Hamburg, Germany. Geschäftsführer: Bernhard Wöbker, Volker John
>
> CONFIDENTIALITY
> NOTICE: This e-mail message, including any attachments, is for the sole
> use of the intended recipient(s) and may contain confidential or
> proprietary information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended recipient,
> immediately contact the sender by reply e-mail and destroy all copies of
> the original message.
>
>
>
>


-- 
Christian Romberg
Chief Engineer | Versant GmbH
(T) +49 40 60990-0
(F) +49 40 60990-113
(E) cromberg_at_versant.com
www.versant.com<http://www.google.com/url?q=http%3A%2F%2Fwww.versant.com%2F&sa=D&sntz=1&usg=AFrqEzeeEBc_gN_8mxtt8xDB0tjXDXQVlw>|
www.db4o.com<http://www.google.com/url?q=http%3A%2F%2Fwww.db4o.com%2F&sa=D&sntz=1&usg=AFrqEzdo3Q40RwKQPBtnPIuBYQd1diFxJQ>
-- 
Versant
GmbH is incorporated in Germany. Company registration number: HRB
54723, Amtsgericht Hamburg. Registered Office: Halenreie 42, 22359
Hamburg, Germany. Geschäftsführer: Bernhard Wöbker, Volker John
CONFIDENTIALITY
NOTICE: This e-mail message, including any attachments, is for the sole
use of the intended recipient(s) and may contain confidential or
proprietary information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
immediately contact the sender by reply e-mail and destroy all copies of
the original message.