You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Purcell <pu...@charter.net> on 2007/03/12 15:11:21 UTC

EJB 3.0 and Hibernate

Hello,

Looking at incorporating the Java Persistence API (EJB 3.0) and was wondering if Tomcat 5.5 supports this. It looks like we need container managed services and was wondering if we can use Tomcat instead of JBoss?

Thanks,
Scott

Re: EJB 3.0 and Hibernate

Posted by Rajesh Chandra <ka...@gmail.com>.
Not sure whether this is a new module you are trying to implement or
refactoring the existing implementation...

As Ron Wheeler suggested, spring framework is one option you can try.

Regards,
Rajesh

On 3/12/07, Markus Schönhaber <ma...@schoenhaber.de> wrote:
>
> Scott Purcell wrote:
>
> > Looking at incorporating the Java Persistence API (EJB 3.0) and was
> > wondering if Tomcat 5.5 supports this. It looks like we need container
> > managed services and was wondering if we can use Tomcat instead of
> JBoss?
>
> Tomcat doesn't support the JPA out of the box. But since it's possible to
> write standalone applications using JPA I don't see a reason why it
> shouldn't
> be possible with Tomcat. You have to provide the relevant classes to your
> WebApp, though. Since you seem to be working with Hibernate: AFAIR the
> Hibernate Annotations package contains ejb3-persistence.jar which should
> get
> you going.
>
> Wrt the container managed services you need, I can't help you. Whether or
> not
> Tomcat is an option for you propably depends on which services you really
> need.
>
> Regards
>   mks
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: EJB 3.0 and Hibernate

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Scott Purcell wrote:

> Looking at incorporating the Java Persistence API (EJB 3.0) and was
> wondering if Tomcat 5.5 supports this. It looks like we need container
> managed services and was wondering if we can use Tomcat instead of JBoss?

Tomcat doesn't support the JPA out of the box. But since it's possible to 
write standalone applications using JPA I don't see a reason why it shouldn't 
be possible with Tomcat. You have to provide the relevant classes to your 
WebApp, though. Since you seem to be working with Hibernate: AFAIR the 
Hibernate Annotations package contains ejb3-persistence.jar which should get 
you going.

Wrt the container managed services you need, I can't help you. Whether or not 
Tomcat is an option for you propably depends on which services you really 
need.

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: EJB 3.0 and Hibernate

Posted by or...@kewlstuff.co.za.
Here you go http://www.hibernate.org/114.html
shows you how to use it in Tomcat


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: EJB 3.0 and Hibernate

Posted by or...@kewlstuff.co.za.
Hi Scott,

Not sure what you mean by container managed service, tomcat on its own is a 
servlet container, not an application container, like JBoss, maybe you saw 
hibernate referenced in Spring which is a whole collection of frameworks 
built on top of servlet technology, it uses hibernate, and has an EJB 
container and everything else you can think of.  Spring competes with JBoss 
and the Sun spec. Some say the reason for EJB3 is because of Springs rapid 
growth and good idea's.

Personally I'm thankful Tomcat hasnt tried to become a "Super Can"... hope 
it never does.

I'm pretty certain that in the Hibernate manual on their site, I saw an 
example of how to persist in servlet technology, but remember its still not 
an application server, all they doing is allowing you to save a session bean 
to disk (dB).  Hibernate is amazing technology, didnt have time to find out 
exactly how they do it, but I think they use reflection to pick up the get 
and set methods and then, insert some method probably via BCEL into the java 
binary class constructor, so that when the class loads it gets the data from 
the dB and populates the properties.... but thats all it really does, its 
not a container on its own.

You can run Hibernate against any Java bean type class, doesnt have to be in 
Tomcat or anything, but I think if your code is something that was written 
for JBOSS and you trying to port it to another container... its going to be 
very very difficult. Probably uses all sorts of annotations that glue it to 
JBOSS.

Anyway if you knew all this, ignore my lecture... and its not a stupid 
question, its seems there are pure application servers out there that 
consider servlet technology to be a component of the application server... 
think it stems from the Sun spec and JBOSS is one of them. Tomcat is just a 
component in JBOSS.
Then there is the Spring framework which seems to have grown off the top of 
Servlet technology, and then there is also RESIN, which most people call a 
very good servlet container, but it also has an EJB container built in. So I 
think its becoming a grey area... Servlet technology is so powerful, I think 
its a natural rival to any other container out there.

Just to prove the point... I wrote an Application server for Tomcat, but I 
must warn you that I dont like the complexity of the Super Cans, and its 
very very simple in comparison... means you will get it running in an hour, 
but if you want to use hibernate, you have to do it yourself, there are no 
annotations or xml glue.
Can get it at http://coolese.100free.com
Anyway its interesting... will the application server absorb the servlet, or 
will the servlet trample the stand alone application server into 
extinction... I think Servlets are winning and will win, which kinda creates 
all sorts of problems for the Sun Specs. Will probably end up as, if you 
want to run a bank... use JBOSS or the Sun equiv, but for everything else I 
think its going to be servlets.

So, dont know what you doing, but dont write off Tomcat or servlets... its 
an absolutely amazing technology... worth a good look.
 If it is just a web application you trying to port, and its used some Super 
Can technology for persistance, I think its going to be easier to replace 
that.
Think you'll find Tomcat a whole lot easier to learn than JBOSS.
Whew! I can waffel :)

----- Original Message ----- 
From: "Scott Purcell" <pu...@charter.net>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, March 12, 2007 4:11 PM
Subject: EJB 3.0 and Hibernate


Hello,

Looking at incorporating the Java Persistence API (EJB 3.0) and was 
wondering if Tomcat 5.5 supports this. It looks like we need container 
managed services and was wondering if we can use Tomcat instead of JBoss?

Thanks,
Scott


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: EJB 3.0 and Hibernate

Posted by Ron Wheeler <rw...@artifact-software.com>.
You might look at Spring  to help make this hang together 
www.springframework.org

Ron

Scott Purcell wrote:
> Hello,
>
> Looking at incorporating the Java Persistence API (EJB 3.0) and was wondering if Tomcat 5.5 supports this. It looks like we need container managed services and was wondering if we can use Tomcat instead of JBoss?
>
> Thanks,
> Scott
>
>   

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org