Although EJB 3.0 is a very elegant framework, it has some limitations. These limitations will not show up in simple applications like the one we used as an example in this book, but in real-life applications, they will.
One of the limitations that you can come across when using JSF for the View and Controller, and EJB for the Model, is the lack of coordination between JSF and EJB when it comes to transactions. In databases, all changes to data happen within a transaction. In the example in this chapter, we updated a single row in the EMPLOYEES
table. The container will simply start a transaction just before the update takes place, and close the transaction immediately after the update. But in more complex applications, it is often necessary to perform multiple actions within a single transaction. This is the case when related records are updated, added, or removed. A database transaction can only be closed if all of the constraints are satisfied.
For...