You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sreyan Chakravarty <sr...@gmail.com> on 2015/08/19 18:03:26 UTC

Is Container Managed Transactions possible in case of Tomcat ?

I planning to use JPA (Hibernate) in a small project that I am developing.
Now I have heard a lot about the benefits of using Container Managed
Transactions(CMT) for JPA in web apps. But most of the tutorials on the web
use either GlassFish or JBoss, so I was wondering is CMT supported by
Tomcat. Send me a link to the documentation for this if there is any.
Please note that I am going to use a datasource to connect to my database
and I am using persistence.xml(JPA style) to use Hibernate.


Regards
Sreyan Chakravarty

Re: Is Container Managed Transactions possible in case of Tomcat ?

Posted by Sreyan Chakravarty <sr...@gmail.com>.
By container managed transactions I mean can I do the following in Tomcat
not TomEE

@PersistenceContext
EntityManager em;

Is it possible to have the entity manager injected at runtime in Tomcat
with JOTM or Atomikos?

On Thu, Aug 20, 2015 at 1:09 PM, Alex Soto <as...@gmail.com> wrote:

> Yes since Apache TomEE is Java EE 6 certified it can runs with any JPA
> provider. As suggested you can use previous links for this. It is really
> simple. Also briefly Apache TomEE 7 M1 (Java EE 7 compatible) will be
> released.
>
> As mentioned subscribe to TomEE mailing list or you can contact myself
> without any problem.
>
> Alex.
>
> El dc., 19 ag. 2015 a les 22:26, Howard W. Smith, Jr. (<
> smithh032772@gmail.com>) va escriure:
>
> > On Aug 19, 2015 3:56 PM, "Sreyan Chakravarty" <sr...@gmail.com>
> > wrote:
> > >
> > > TomEE supports Apache OpenJPA. What if I wanted to use Hibernate as my
> > JPA
> > > provider ?
> > >
> >
> > I searched Google for
> >
> > tomee hibernate tutorial
> >
> > And found
> >
> > http://tomee.apache.org/examples-trunk/jpa-hibernate/README.html
> >
> > https://rmannibucau.wordpress.com/2012/07/01/hibernate-tomee/
> >
> > And many more. Please subscribe to the Apache TomEE user list, download
> > latest version, and ask any further questions on the tomee user list.
> >
> > > On Wed, Aug 19, 2015 at 9:53 PM, Alex Soto <as...@gmail.com> wrote:
> > >
> > > > Yeah in this case you should take a look at Apache TomEE which is
> > Apache
> > > > Tomcat + Java EE and you will get all of these for free :).
> > > >
> > > > El dc., 19 ag. 2015 a les 18:18, Daniel Mikusa (<dmikusa@pivotal.io
> >)
> > va
> > > > escriure:
> > > >
> > > > > On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty <
> > > > > sreyan.mailing@gmail.com> wrote:
> > > > >
> > > > > > I planning to use JPA (Hibernate) in a small project that I am
> > > > > developing.
> > > > > > Now I have heard a lot about the benefits of using Container
> > Managed
> > > > > > Transactions(CMT) for JPA in web apps. But most of the tutorials
> on
> > the
> > > > > web
> > > > > > use either GlassFish or JBoss, so I was wondering is CMT
> supported
> > by
> > > > > > Tomcat. Send me a link to the documentation for this if there is
> > any.
> > > > > > Please note that I am going to use a datasource to connect to my
> > > > database
> > > > > > and I am using persistence.xml(JPA style) to use Hibernate.
> > > > > >
> > > > >
> > > > > If you're referring to JTA, then no.  Tomcat doesn't implement
> that.
> > > > > Tomcat only implements a subset of the JEE spec.
> > > > >
> > > > > http://tomcat.apache.org/whichversion.html
> > > > >
> > > > > However most of the parts of the spec that Tomcat does not
> implement
> > can
> > > > be
> > > > > pulled in via libraries.  For JTA you can use a third party
> > > > implementation
> > > > > with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to
> mind.
> > > > >
> > > > > These docs are a little dated, but should get you started.
> > > > >
> > > > > http://www.atomikos.com/Documentation/TomcatIntegration
> > > > > http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
> > > > >
> > > > > Dan
> > > > >
> > > >
> >
>

Re: Is Container Managed Transactions possible in case of Tomcat ?

Posted by Alex Soto <as...@gmail.com>.
Yes since Apache TomEE is Java EE 6 certified it can runs with any JPA
provider. As suggested you can use previous links for this. It is really
simple. Also briefly Apache TomEE 7 M1 (Java EE 7 compatible) will be
released.

As mentioned subscribe to TomEE mailing list or you can contact myself
without any problem.

Alex.

El dc., 19 ag. 2015 a les 22:26, Howard W. Smith, Jr. (<
smithh032772@gmail.com>) va escriure:

> On Aug 19, 2015 3:56 PM, "Sreyan Chakravarty" <sr...@gmail.com>
> wrote:
> >
> > TomEE supports Apache OpenJPA. What if I wanted to use Hibernate as my
> JPA
> > provider ?
> >
>
> I searched Google for
>
> tomee hibernate tutorial
>
> And found
>
> http://tomee.apache.org/examples-trunk/jpa-hibernate/README.html
>
> https://rmannibucau.wordpress.com/2012/07/01/hibernate-tomee/
>
> And many more. Please subscribe to the Apache TomEE user list, download
> latest version, and ask any further questions on the tomee user list.
>
> > On Wed, Aug 19, 2015 at 9:53 PM, Alex Soto <as...@gmail.com> wrote:
> >
> > > Yeah in this case you should take a look at Apache TomEE which is
> Apache
> > > Tomcat + Java EE and you will get all of these for free :).
> > >
> > > El dc., 19 ag. 2015 a les 18:18, Daniel Mikusa (<dm...@pivotal.io>)
> va
> > > escriure:
> > >
> > > > On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty <
> > > > sreyan.mailing@gmail.com> wrote:
> > > >
> > > > > I planning to use JPA (Hibernate) in a small project that I am
> > > > developing.
> > > > > Now I have heard a lot about the benefits of using Container
> Managed
> > > > > Transactions(CMT) for JPA in web apps. But most of the tutorials on
> the
> > > > web
> > > > > use either GlassFish or JBoss, so I was wondering is CMT supported
> by
> > > > > Tomcat. Send me a link to the documentation for this if there is
> any.
> > > > > Please note that I am going to use a datasource to connect to my
> > > database
> > > > > and I am using persistence.xml(JPA style) to use Hibernate.
> > > > >
> > > >
> > > > If you're referring to JTA, then no.  Tomcat doesn't implement that.
> > > > Tomcat only implements a subset of the JEE spec.
> > > >
> > > > http://tomcat.apache.org/whichversion.html
> > > >
> > > > However most of the parts of the spec that Tomcat does not implement
> can
> > > be
> > > > pulled in via libraries.  For JTA you can use a third party
> > > implementation
> > > > with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to mind.
> > > >
> > > > These docs are a little dated, but should get you started.
> > > >
> > > > http://www.atomikos.com/Documentation/TomcatIntegration
> > > > http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
> > > >
> > > > Dan
> > > >
> > >
>

Re: Is Container Managed Transactions possible in case of Tomcat ?

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Aug 19, 2015 3:56 PM, "Sreyan Chakravarty" <sr...@gmail.com>
wrote:
>
> TomEE supports Apache OpenJPA. What if I wanted to use Hibernate as my JPA
> provider ?
>

I searched Google for

tomee hibernate tutorial

And found

http://tomee.apache.org/examples-trunk/jpa-hibernate/README.html

https://rmannibucau.wordpress.com/2012/07/01/hibernate-tomee/

And many more. Please subscribe to the Apache TomEE user list, download
latest version, and ask any further questions on the tomee user list.

> On Wed, Aug 19, 2015 at 9:53 PM, Alex Soto <as...@gmail.com> wrote:
>
> > Yeah in this case you should take a look at Apache TomEE which is Apache
> > Tomcat + Java EE and you will get all of these for free :).
> >
> > El dc., 19 ag. 2015 a les 18:18, Daniel Mikusa (<dm...@pivotal.io>) va
> > escriure:
> >
> > > On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty <
> > > sreyan.mailing@gmail.com> wrote:
> > >
> > > > I planning to use JPA (Hibernate) in a small project that I am
> > > developing.
> > > > Now I have heard a lot about the benefits of using Container Managed
> > > > Transactions(CMT) for JPA in web apps. But most of the tutorials on
the
> > > web
> > > > use either GlassFish or JBoss, so I was wondering is CMT supported
by
> > > > Tomcat. Send me a link to the documentation for this if there is
any.
> > > > Please note that I am going to use a datasource to connect to my
> > database
> > > > and I am using persistence.xml(JPA style) to use Hibernate.
> > > >
> > >
> > > If you're referring to JTA, then no.  Tomcat doesn't implement that.
> > > Tomcat only implements a subset of the JEE spec.
> > >
> > > http://tomcat.apache.org/whichversion.html
> > >
> > > However most of the parts of the spec that Tomcat does not implement
can
> > be
> > > pulled in via libraries.  For JTA you can use a third party
> > implementation
> > > with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to mind.
> > >
> > > These docs are a little dated, but should get you started.
> > >
> > > http://www.atomikos.com/Documentation/TomcatIntegration
> > > http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
> > >
> > > Dan
> > >
> >

Re: Is Container Managed Transactions possible in case of Tomcat ?

Posted by Sreyan Chakravarty <sr...@gmail.com>.
TomEE supports Apache OpenJPA. What if I wanted to use Hibernate as my JPA
provider ?

On Wed, Aug 19, 2015 at 9:53 PM, Alex Soto <as...@gmail.com> wrote:

> Yeah in this case you should take a look at Apache TomEE which is Apache
> Tomcat + Java EE and you will get all of these for free :).
>
> El dc., 19 ag. 2015 a les 18:18, Daniel Mikusa (<dm...@pivotal.io>) va
> escriure:
>
> > On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty <
> > sreyan.mailing@gmail.com> wrote:
> >
> > > I planning to use JPA (Hibernate) in a small project that I am
> > developing.
> > > Now I have heard a lot about the benefits of using Container Managed
> > > Transactions(CMT) for JPA in web apps. But most of the tutorials on the
> > web
> > > use either GlassFish or JBoss, so I was wondering is CMT supported by
> > > Tomcat. Send me a link to the documentation for this if there is any.
> > > Please note that I am going to use a datasource to connect to my
> database
> > > and I am using persistence.xml(JPA style) to use Hibernate.
> > >
> >
> > If you're referring to JTA, then no.  Tomcat doesn't implement that.
> > Tomcat only implements a subset of the JEE spec.
> >
> > http://tomcat.apache.org/whichversion.html
> >
> > However most of the parts of the spec that Tomcat does not implement can
> be
> > pulled in via libraries.  For JTA you can use a third party
> implementation
> > with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to mind.
> >
> > These docs are a little dated, but should get you started.
> >
> > http://www.atomikos.com/Documentation/TomcatIntegration
> > http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
> >
> > Dan
> >
>

Re: Is Container Managed Transactions possible in case of Tomcat ?

Posted by Alex Soto <as...@gmail.com>.
Yeah in this case you should take a look at Apache TomEE which is Apache
Tomcat + Java EE and you will get all of these for free :).

El dc., 19 ag. 2015 a les 18:18, Daniel Mikusa (<dm...@pivotal.io>) va
escriure:

> On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty <
> sreyan.mailing@gmail.com> wrote:
>
> > I planning to use JPA (Hibernate) in a small project that I am
> developing.
> > Now I have heard a lot about the benefits of using Container Managed
> > Transactions(CMT) for JPA in web apps. But most of the tutorials on the
> web
> > use either GlassFish or JBoss, so I was wondering is CMT supported by
> > Tomcat. Send me a link to the documentation for this if there is any.
> > Please note that I am going to use a datasource to connect to my database
> > and I am using persistence.xml(JPA style) to use Hibernate.
> >
>
> If you're referring to JTA, then no.  Tomcat doesn't implement that.
> Tomcat only implements a subset of the JEE spec.
>
> http://tomcat.apache.org/whichversion.html
>
> However most of the parts of the spec that Tomcat does not implement can be
> pulled in via libraries.  For JTA you can use a third party implementation
> with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to mind.
>
> These docs are a little dated, but should get you started.
>
> http://www.atomikos.com/Documentation/TomcatIntegration
> http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html
>
> Dan
>

Re: Is Container Managed Transactions possible in case of Tomcat ?

Posted by Daniel Mikusa <dm...@pivotal.io>.
On Wed, Aug 19, 2015 at 12:03 PM, Sreyan Chakravarty <
sreyan.mailing@gmail.com> wrote:

> I planning to use JPA (Hibernate) in a small project that I am developing.
> Now I have heard a lot about the benefits of using Container Managed
> Transactions(CMT) for JPA in web apps. But most of the tutorials on the web
> use either GlassFish or JBoss, so I was wondering is CMT supported by
> Tomcat. Send me a link to the documentation for this if there is any.
> Please note that I am going to use a datasource to connect to my database
> and I am using persistence.xml(JPA style) to use Hibernate.
>

If you're referring to JTA, then no.  Tomcat doesn't implement that.
Tomcat only implements a subset of the JEE spec.

http://tomcat.apache.org/whichversion.html

However most of the parts of the spec that Tomcat does not implement can be
pulled in via libraries.  For JTA you can use a third party implementation
with Tomcat.  Atomikos, JOTM and Bitronix are ones that come to mind.

These docs are a little dated, but should get you started.

http://www.atomikos.com/Documentation/TomcatIntegration
http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html

Dan