Source Listing
Following is a full listing of all source code used in this runnable example.
Implementation Resources
See Chapter 9.
SimpleEmployee.java
package org.jboss.ejb3.examples.employeeregistry.ch09.entitymanager; import javax.persistence.Entity; import javax.persistence.Id; /** * Represents an Employee in the system. Modeled as a simple * value object with some additional EJB and JPA annotations. * * @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a> * @version $Revision: $ */ @Entity // Mark that we're an Entity Bean, EJB's integration point // with Java Persistence public class SimpleEmployee { //--------------------------------------------------------------------------|| // Instance Members --------------------------------------------------------|| //--------------------------------------------------------------------------|| /** * Primary key of this entity */ @Id // Mark that this field is the primary key private Long id; /** * Name of the employee */ private String name; //--------------------------------------------------------------------------|| // Constructor -------------------------------------------------------------|| //--------------------------------------------------------------------------|| /** * Default constructor, required by JPA */ public SimpleEmployee() { } /** * Convenience constructor */ public SimpleEmployee(final long id, final String name) { // Set this.id = id; this.name = name; } //--------------------------------------------------------------------------|| ...
Get Enterprise JavaBeans 3.1, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.