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 ]
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
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...
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.
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>