+ * The bean is session scoped such that we can have session-based caches of + * database content such as authors or books in this bean. In this simple + * example, we haven't gone into concurrency situations where multiple sessions + * update the library database at the same time, in case of which we might need + * to turn on optimistic locking in jOOQ. * * @author Lukas Eder */ -@Named("authors") +@Named("library") @SessionScoped -public class Authors implements Serializable { +public class Library implements Serializable { private static final long serialVersionUID = 1L; @EJB - private AuthorsEJB ejb; + private LibraryEJB ejb; - // Caches from the DB + // Various caches from the DB + // ------------------------------------------------------------------------- + + /** + * An empty {@link AuthorRecord} that can be used to insert new authors. + */ private AuthorRecord newAuthor; + + /** + * An empty {@link BookRecord} that can be used to insert new books. + */ private BookRecord newBook; + + /** + * The reference to the {@link Record} that is currently being edited. + */ private Record edit; + + /** + * The sort field for each {@link Table}. + */ private Map