*
The moose likes EJB and other Java EE Technologies and the fly likes To Authors Mike, Merrick:  EJB 3.0 advantages over Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "To Authors Mike, Merrick:  EJB 3.0 advantages over Hibernate" Watch "To Authors Mike, Merrick:  EJB 3.0 advantages over Hibernate" New topic
Author

To Authors Mike, Merrick: EJB 3.0 advantages over Hibernate

Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
Mike Keith and Merrick Schincariol:-

How would you justify usage of EJB 3.0 over hibernate keeping in mind following concerns
1)Supporting multiple databases
2)Lightweight O/R mapping framework (Hibernate)
3)No EJB container is required for Hibernate, which can run on any servlet container. EJB can't be deployed on servlet container.
Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
1)Supporting multiple databases

JPA is also database agnostic but the mappings are standardized, not proprietary.
2)Lightweight O/R mapping framework (Hibernate)

JPA is more lightweight than Hibernate or any other vendor impl.
3)No EJB container is required for Hibernate, which can run on any servlet container. EJB can't be deployed on servlet container.

JPA can be deployed in a servlet container, an EJB container, and outside any Java EE container at all (i.e. it can run just sitting in a Java SE runtime). When it does run inside a Java EE Container, though, the level of integration that you get with the Container surpasses what Hibernate or any other ORM framework can offer, and does so in a completely portable manner.

Remember, JPA is a specification, or API, not an implementation. Programming to a spec is always going to give you more portability. The weight of the implementation depends upon the provider that you use underneath.

-Mike


-Mike
Pro JPA 2: Mastering the Java Persistence API
Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
Originally posted by Mike Keith:

JPA can be deployed in a servlet container, an EJB container, and outside any Java EE container at all (i.e. it can run just sitting in a Java SE runtime). When it does run inside a Java EE Container, though, the level of integration that you get with the Container surpasses what Hibernate or any other ORM framework can offer, and does so in a completely portable manner.

Remember, JPA is a specification, or API, not an implementation. Programming to a spec is always going to give you more portability. The weight of the implementation depends upon the provider that you use underneath.

-Mike


Thanks for the response Mike. Agreed on what you mentioned above. Though JPA is portable and can be deployed outside EE container, deployment of EJB 3.0 would still require EJB container.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

JPA is more lightweight than Hibernate or any other vendor impl.


How is JPA more light weight than Hibernate ? Thanks.


Groovy
Merrick Schincariol
author
Greenhorn

Joined: Aug 15, 2006
Posts: 17
I believe Mike is referring to the size of the API, not the size of the implementation. The EntityManager and Query interfaces are relatively concise, yet still allow for a significant amount of power and flexibility.

Cheers,

Merrick
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
Originally posted by Mike Keith:

When JPA does run inside a Java EE Container, though, the level of integration that you get with the Container surpasses what Hibernate or any other ORM framework can offer, and does so in a completely portable manner.
-Mike


is it possible to use JPA without entity bean at all?

thanks,
anthony


SCJP 5
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

is it possible to use JPA without entity bean at all?

Yes, JPA can be used with anything. It can be used with J2SE too.


[My Blog]
All roads lead to JavaRanch
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
Originally posted by Satou kurinosuke:

Yes, JPA can be used with anything. It can be used with J2SE too.


I meant if we use JPA in EJB 3 container/enviroment, should we use Entity Bean (any advantage) or not?

btw, will Hibernate and others follow this JPA specification?

thanks again
anthony
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

btw, will Hibernate and others follow this JPA specification?

Yes
Mike Keith
author
Ranch Hand

Joined: Jul 14, 2005
Posts: 304
Originally posted by Anthony Karta:
I meant if we use JPA in EJB 3 container/enviroment, should we use Entity Bean (any advantage) or not?
No, the entity bean model that includes entity-bean demarcated transactions and security is not recommended. It is more heavyweight than what is usually appropriate. People should use session beans for transaction demarcation and use the new JPA entity API for persistence.

-Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To Authors Mike, Merrick: EJB 3.0 advantages over Hibernate
 
Similar Threads
Does EJB 3.0 use AOP?
Pro EJB - Book Features
EKB 3.0 and Hibernate Similarities in the Book of EJB 3.0
whats new in ejb 3.0
Migration paths from Spring to EJB 3.0?