users@glassfish.java.net

[gf-users] Re: Glassfish JDBC Connection Pool property question

From: Noah White <emailnbw_at_gmail.com>
Date: Fri, 11 Jul 2014 17:39:32 -0400

On Jul 11, 2014, at 5:27 PM, Reza Rahman <Reza.Rahman_at_oracle.com> wrote:

> Responses in-line:
>
> On 7/11/2014 5:10 PM, Noah White wrote:
>> Hi Reza:
>>
>> So I have some EJBs which are annotated with @TransactionAttribute(TransactionAttribute.NOT_SUPPORTED) , they make read-only calls to the DB, and they run without throwing any exceptions whether or not this box is checked off so my question is basically two fold:
>>
>> 1. Whats the purpose of this setting? (The User’s Guide doesn’t give anymore detail then the GUI does)
>
> It is basically saying that the connection will not participate in a transaction (likely either JTA or local).
>
>> 2. What are the expectations in this case? (So I can determine if this is expected or a bug)
>
> That really depends on the entity manager you are using. Assuming you are using a transaction scoped managed JPA object it will allow you to do read operations without a transaction and throw an exception otherwise.

Yes, I’m using EJB 3.1 CMT and the PC associated with the injected EM is a JTA resource using this connection pool.

My confusion around this setting comes from the fact that I have EJB methods that start TXs and I have EJB methods which explicitly do not w/NOT_SUPPORTED.

Whether or not this box is checked off, my code (both the TX EJB methods and the ones marked NOT_SUPPORTED) will run w/out throwing an exception. I would have thought that if the check box is not checked, in the case where I have an EJB method annotated with NOT_SUPPORTED, the underlying connection would still be in a TX (which would violate the EJB annotations contract) or an exception would be thrown. I don’t see an exception.

-Noah