11.5. Summary

In this chapter, you implemented conversations with Hibernate, JPA, and EJB 3.0 components. You learned how to propagate the current Hibernate Session and the persistence context to create more complex layered applications without leaking concerns. You've also seen that persistence-context propagation is a deeply integrated feature of EJB 3.0 and that a persistence context can be easily bound to the JTA (or CMT) transaction scope. You've seen how FlushMode.MANUAL, a Hibernate feature, can disable flushing of your persistence context independently from your transaction assembly.

Table 11.2 shows a summary you can use to compare native Hibernate features and Java Persistence.

Table 11-2. Hibernate and JPA comparison chart for chapter 11
Hibernate CoreJava Persistence and EJB 3.0
Persistence context propagation is available with thread or JTA transaction binding in Java SE and Java EE. Persistence contexts are either scoped to the transaction, or managed by the application.Java Persistence standardizes a persistence context propagation model for Java EE only, deeply integrated with EJB 3.0 components. Persistence context scoping, to transactions or to stateful session beans, is well defined.
Hibernate supports a conversation implementation with detached objects, these objects can be reattached or merged during a conversation.Java Persistence standardizes merging of detached objects, but has no support for reattachment.
Hibernate supports disabling automatic flushing of persistence contexts for long conversations with the FlushMode.MANUAL option.Disabling automatic flushing of an extended persistence context requires nontransactional event processing (with serious restrictions on application design and layering) or a Hibernate fallback to FlushMode.MANUAL.

In the next chapter, we'll look at various options you should rely on whenever you need to work with more complex and larger datasets. You'll see how transitive persistence works with Hibernate's cascading model, how to execute batch and bulk operations efficiently, and how to hook into and manipulate the Hibernate default behavior when objects are loaded and stored.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.208.181