concept home component in category seam

This is an excerpt from Manning's book Seam in Action.
Don’t feel that you have to make the decision between Java or XML up front. From the standpoint of the rest of the application, the end result is the same, a Seam component. You can comfortably mix the two styles in your application, or even on the same component. In fact, the most flexible approach is to define properties in XML and the methods on a subclass, referencing the subclass in the component descriptor. This flexibility is the essence of the unified component model in Seam. You’re now ready to swing away by implementing CRUD screens to manage instances of the Round entity using a Home component.
If an existing entity can’t be located in the database, the Home component raises the exception org.jboss.seam.framework.EntityNotFoundException, which results in a 404 error page being displayed as declared by the @HttpError annotation on the exception class. If a persistence exception is thrown, you can handle it in one of two ways. You can override the CRUD methods on Home and implement a try/catch block, or you can register an exception handler in the global page descriptor to direct the user to an error page as follows:
<exception class="javax.persistence.OptimisticLockException"> <redirect view-id="/error.xhtml"> <end-conversation/> <message>The record was modified by another user.</message> </redirect> </exception> <exception class="javax.persistence.PersistenceException"> <redirect view-id="/error.xhtml"> <message>The operation failed. Please try again.</message> </redirect> </exception>You’ve now seen the key aspects of the Home component and how it’s used to implement a CRUD scenario. Although there wasn’t a lot of Java code, you did have to write code to make it work (the wiring of the tee set and the revert logic). If you’re one of those people who would rather “program in XML”—you know who you are—you’ll be excited to hear that you can commission a Home while steering clear of Java. To demonstrate, we add a new feature that lets a golfer add a review to a golf course.
Seam answers this challenge by introducing the Home component (herein referred to as a Home). A Home manages an entity instance by caching it and coordinating CRUD operations on it with the persistence manager, all completely transparent to the entity instance. Each Home is represented by the Home class, which extends from PersistenceController, or any subclass of Home. As I’ve alluded to throughout this chapter, the framework classes, such as Home, are abstract classes that are, in reality, just component templates. They are also agnostic of the persistence framework. Seam provides two implementations of Home: one for JPA, EntityHome, and one for Hibernate, HibernateEntityHome. The class diagram for EntityHome is shown in figure 10.3. This section teaches you how to use the Home component, focusing on the JPA implementation.