users@glassfish.java.net

Re: Injecting a UserTransaction via deployment-descriptor

From: <glassfish_at_javadesktop.org>
Date: Wed, 05 Nov 2008 08:40:50 PST

Hi Ralph,

Use a resource-ref instead of a resource-env-ref. You also need to specify the type of the resource.

<resource-ref>
   <res-ref-name>UserTransaction</res-ref-name>
   <res-ref-type>javax.transaction.UserTransaction</res-ref-type>
   <injection-target>
     <injection-target-class>test.server.compile.TestBean</injection-target-class>
     <injection-target-name>userTransaction</injection-target-name>
   </injection-target>
</resource-ref>

This is equivalent to the following annotation on a field of the bean class :

@Resource(name="UserTransaction") UserTransaction userTransaction;
[Message sent by forum member 'ksak' (ksak)]

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