Bug 1129293 - Use @Resource instead of @Inject for BMT example
Summary: Use @Resource instead of @Inject for BMT example
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Documentation
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: ---
Assignee: sgilda
QA Contact: Ondrej Chaloupka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-12 14:20 UTC by Ondrej Chaloupka
Modified: 2014-08-14 15:20 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
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


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.