aspose file tools*
The moose likes Object Relational Mapping and the fly likes EJB entity 3.0 vs Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "EJB entity 3.0 vs Hibernate" Watch "EJB entity 3.0 vs Hibernate" New topic
Author

EJB entity 3.0 vs Hibernate

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Hello author,

EJB entity beans 3.0 will be based on Hibernate idea. So how does this differ from Hibernate ? Why should I choose one over another. I know that Hibernate is a open source product but any other reason why hibernate is better than EJB 3.0

Others are welcome to give their comments.
[ August 31, 2004: Message edited by: Pradeep Bhat ]

Groovy
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
EJB specification is much larger than only persistence layer. So EJB spec is related to Hibernate only for the persistence layer. The rest is another story.


blog - InfoQ.com
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

EJB specification is much larger than only persistence layer. So EJB spec is related to Hibernate only for the persistence layer.


Yes, you are right. I have edited the subject so we discuss about entity bean in EJB 3.0 with Hibernate. I am interested to know comments from Gavin King. :roll:
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Ultra-high performance
1. Lazy initialization
for collections
for objects (uses runtime bytecode enhancement - no need to implement interfaces)
2. Outer join fetching
to initialize a graph of associated objects in a single select (for databases with ANSI-style or Oracle-style outerjoins)

3. Batch fetching
Association roles may be fetched predictively, by batch

4. Support for optimistic locking with versioning/timestamping
Allows a single conversation (Session) to extend across multiple database connections / transactions without sacrificing transaction isolation. Version numbers / timestamps are updated automatically by Hibernate.

5. Highly scalable architecture
Designed from the ground up to work in a cluster. Unless the second-level cache is used, there is essentially NO synchronization used in the entire persistence layer. Transaction isolation is guaranteed by the way Hibernate integrates with database / JTA transactions.

6. High performance
Minimal overhead compared to direct JDBC.

7. No "special" database tables
Hibernate itself has no persistent state - so theres no extra database tables maintaining locks, mapping data, etc.

8. SQL generated at system initialization time
rather than at runtime (or buildtime).

9. (Optional) Internal connection pooling and PreparedStatement caching



Reference Website
http://www.hibernate.org/21.html


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Well, I think this issue is simlar to that of JSF and Struts... Since JSF is supported by Sun and people think that the penetration of JSF would eliminate Struts in the future, even though their natures are not that common...

I think EJB 3.0 got different natures as compared to Hibernate... Even though EJB is supported by Sun. It won't eliminate Hibernate for sure...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Update EJB 3.0 :: http://today.java.net/pub/a/today/2004/08/05/ejbnewlife.html



the changes are in the following areas:

1.The DTO mechanism has been overhauled and simplified.
2.The interfaces have been further rationalised and simplified making the model extremely simple (POJOs and POJIs).
3. Testability outside the container is possible for all bean methods which do not require container services.
Gavin King
author
Ranch Hand

Joined: Aug 31, 2004
Posts: 76
Hibernate 2.x and 3.x do not implement the proposed EJB 3.0 APIs! Well, EJB 3.0 shares many concepts in common with Hibernate. However, EJB3 is a proposed JCP standard for server-side Java business logic - which encompasses much more than persistence - whereas Hibernate is a specific implementation of ORM persistence.

Once JSR-220 is finalized, there will be at least three ways you might use Hibernate:

(1) by coding to Hibernate-specific APIs (as today)
(2) by coding to EJB3 APIs, and running the Hibernate-based EntityManager standalone
(3) by coding to EJB3 APIs, and running Hibernate as the implementation of EntityManager inside JBoss

So basically, we will write a wrapper around Hibernate that implements EJB3. But we do not envisage that everyone will prefer the EJB3 APIs, especially since Hibernate offers many features that EJB3 does not.

P.S. The ... ah ... "new life for EJB" guys are .. ahem... not really involved in the official EJB 3.0 specification.


Co-Author of <a href="http://www.amazon.com/exec/obidos/ASIN/193239415X/ref=jranch-20" target="_blank" rel="nofollow">Hibernate in Action</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB entity 3.0 vs Hibernate
 
Similar Threads
Entity beans
new to hibernate
Hibernate vs EJB 3.0
Do you consider hibernate J2EE technology?
EJB 3.0 and Hibernate