users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: updated spec draft: unsynchronized persistence contexts

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Tue, 29 Nov 2011 15:54:12 -0800

On 11/29/2011 12:25 PM, Linda DeMichiel wrote:
>
>
> On 11/29/2011 11:08 AM, Emmanuel Bernard wrote:

[snip]

>> 7.4
>> EntityManagerFactory.addNamedQuery
>> As I raised initially, I'm still unclear how a user would properly use this feature. Where in his code would it add a
>> new named query and make sure this has not been added before. To me it'd be preferable to have some initialization
>> hook to set such queries. I'm happy to change my mind but I looked up my emails and I don't think anyone came up with
>> a use case for the current proposed form.
>> Note that this also avoid a bunch of concurrent safe structures as well but that's impl details.
>>
>> See the thread named Re: named queries and my exchange with Gordon from April 28th forward.
>>
>
> OK. Unfortunately, we don't have a well-defined initialization sequence, and the EMF
> may be created by the container before application code gets to execute. However, a
> startup singleton EJB's postConstruct could be used for adding named queries, or a
> servlet init method. In the mean time, do you think addNamedQuery has so little
> value that we should remove it?
>

Cancel that last question. I've just been trading emails with one of the members
of the users list, who immediately urged me not to even think of taking this away!

-Linda