tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars-Fredrik Smedberg <itsme...@gmail.com>
Subject Re: JDBC Transactions vs EJBs and @TransactionAttribute(...) and more...
Date Tue, 14 Oct 2014 23:19:18 GMT
Hi Romain

Thanks for the link to the ManagedConnection, some questions on it (so I
understand it correctly)

- The connection is bound to the tx when the first method is called on the
connect (except for toString, equals and hashcode), and if its not already
bound, correct?
- Do I understand correctly that I will always use (using delegation in the
proxy) the same connection (the one bound to the tx) regardless of if I use
getConnection()/close() multiple times within an EJB that handles tx?
- In the above case the connection I think I'm using (when I simple look at
the code) is returned to the pool and the bound one is used?

Where can I get more understanding of the TransactionManager and its
relation to the transactions annotated in the EJB?

Very nice to take a look at the code, really makes the understanding alot
easier, thanks!

/LF


On Wed, Oct 15, 2014 at 1:03 AM, Romain Manni-Bucau <rmannibucau@gmail.com>
wrote:

> Hi
>
> this is actually more bound to JTA (you can read
>
> http://svn.apache.org/repos/asf/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/managed/local/ManagedConnection.java
> )
>
>
> 2014-10-15 0:14 GMT+02:00 Lars-Fredrik Smedberg <itsmeden@gmail.com>:
> > Hi
> >
> > Using JDBC, creating a connection and setting it to auto commit false to
> be
> > able to group more than one statement into a single transaction I
> > understand.
> >
> > - Is it possible to compare that to an EJB with a @TransactionAttribute
> > set? I would like to understand more in detail how the EJB handles
> > transactions, datasources and connections "under the hood".
> > (it all comes from a discussion with a DBA)
> >
> > If I use @Resource to inject a Datasource and use to retrieve a
> connection
> > I usually call close on it after I done using it,
> >
> > - Will close on the connection actually close it or is that done at the
> > commit of the transaction (assume we are in an EJB with
> > @TransactionAttribute set)?
>
> will be done later to support rollback
>
> > - Will the container automatically set auto commit false to any
> connections
> > retrieved within the transaction?
>
> all JTA ones, can also depend on JPA provider config
>
> > - ... and many more questions :)
> >
> > Maybe I'm mixing the topics a bit but it would be really great to
> > understand it all more in-depth to be able to have the understanding and
> > discuss it with the DBA.
> >
> > Thanks
> >
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at itsmeden@gmail.com, and destroy all copies of this
> > message and any attachments.
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message