Bug 1129293

Summary: Use @Resource instead of @Inject for BMT example
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Ondrej Chaloupka <ochaloup>
Component: DocumentationAssignee: sgilda
Status: CLOSED NOTABUG QA Contact: Ondrej Chaloupka <ochaloup>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: hhovsepy, mmusgrov, pmuir, sgilda, tom.jenkinson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Build Name: 22816, Development Guide-6.3-1 Build Date: 08-08-2014 15:41:08 Topic ID: 4305-591659 [Latest]
Last Closed: 2014-08-12 17:13:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ondrej Chaloupka 2014-08-12 14:20:16 UTC
Title: Commit a Transaction

Hi,

I found that @Inject annotation is used at BTM example. At point 1. Call the commit() method on the UserTransaction there is used in code notation:

@Inject
private UserTransaction userTransaction;

it does not work in Java EE 6. Please change it to

@Resource
private UserTransaction userTransaction;


In case the title of point 1. could be change to contain information about bean managed transaction "mode". Title could be something like:
If you use Bean Managed Transactions (BMT), call the commit() method on the UserTransaction

Thank you
Ondra

Comment 1 sgilda 2014-08-12 16:15:40 UTC
Ondrej, all the quickstarts use the @Inject and work fine with Java EE 6. 

Check out the code in the following quickstarts:

bmt
cdi-veto
greeter
jta-crash-rec

Adding Mike and Tom to get more clarification.

Comment 2 sgilda 2014-08-12 16:23:44 UTC
The Oracle documentation uses @Resource:
http://docs.oracle.com/javaee/6/tutorial/doc/gmgli.html
http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv004.htm

It sounds like we do need to change the documentation and the quickstarts.

Waiting to see what Mike and Tom say.

Comment 3 Pete Muir 2014-08-12 16:34:01 UTC
You can inject UserTransaction in to a CDI bean in Java EE 6. This is defined in CDI 1.0 Section 3.6 (http://docs.jboss.org/cdi/spec/1.0/html_single/#d0e2363). If this does not work, it is a bug in EAP NOT the quickstart.

Comment 4 Pete Muir 2014-08-12 16:41:54 UTC
Setting devel nack to -

Comment 5 sgilda 2014-08-12 17:13:42 UTC
Thanks Pete. 

Because the quickstarts all work and were tested thoroughly by QA, I am not changing the code example in the documentation. 

Closing this as not a bug.

Comment 6 Ondrej Chaloupka 2014-08-13 11:05:49 UTC
Yeap, sorry Sande.

I was terribly mistaken. I did a mistake in my deployment and as I saw that the most documentation about the injection of UserTransaction points to injection by resource so I thought that injection by Inject is rather feature of java ee 7.

Once again, sorry for this bug.