File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To Authors Mike, Merrick: EJB 3.0 advantages over Hibernate

 
Vicky Pandya
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 304
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vicky Pandya
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JPA is more lightweight than Hibernate or any other vendor impl.


How is JPA more light weight than Hibernate ? Thanks.
 
Merrick Schincariol
author
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 342
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anthony Karta
Ranch Hand
Posts: 342
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
btw, will Hibernate and others follow this JPA specification?

Yes
 
Mike Keith
author
Ranch Hand
Posts: 304
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic