users@glassfish.java.net

Re: Specification question related to overriding annotations

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 Mar 2008 09:07:31 PST

Hi Laird,

You should be able to override, but the association between the annotation and the .xml elements is based on the component environment name of the dependency. In the case of @PersistenceContext that means the name() attribute, which isn't specified in your example. If not specified, it defaults to <fully-qualified-name-of-declaring-class>/<field-name>. So, you'll either have to specify the name() attribute as

@PersistenceContext(name="persistence/FoobarPersistenceContext) to match the .xml

or

update the persistence-context-ref-name element to match the result of the default for the abstract class.

 --ken
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=264633