10.4. Summary

In this chapter, you learned about transactions, concurrency, isolation, and locking. You now know that Hibernate relies on the database concurrency control mechanism but provides better isolation guarantees in a transaction, thanks to automatic versioning and the persistence context cache. You learned how to set transaction boundaries programmatically with the Hibernate API, JTA UserTransaction, and the JPA EntityTransaction interface. We also looked at transaction assembly with EJB 3.0 components and how you can work nontransactionally with autocommit mode.

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

Table 10-1. Hibernate and JPA comparison chart for Chapter 10
Hibernate CoreJava Persistence and EJB 3.0
The Transaction API can be configured for JDBC and JTA.The EntityTransaction API is only useful with resource-local transactions.
Hibernate can be configured to integrate with JTA and container-managed transactions in EJBs.With Java Persistence, no extra configuration besides the database connection name changes between Java SE and Java EE.
Hibernate defaults to optimistic concurrency control for best scalability, with automatic versioning.Java Persistence standardizes optimistic concurrency control with automatic versioning.

We've now finished our discussion and exploration of the fundamentals involved in storing and loading objects in a transactional fashion. Next, we'll bring all the pieces together by creating more realistic conversations between the user and the application.

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

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