# Customer_APK.ejb Sample

This topic inludes the source code for the Customer_APK.ejb Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/EJBs/automaticPK/

## Sample Source Code

`01 package automaticPK; 02 03 import javax.ejb.*; 04 import weblogic.ejb.*; 05 06 /** 07 * @ejbgen:automatic-key-generation cache-size="1" name="NamedSequence" 08 * type="NamedSequenceTable" 09 * 10 * @ejbgen:entity default-transaction="Supports" prim-key-class="java.lang.Integer" 11 * ejb-name="Customer_APK" 12 * data-source-name="cgSampleDataSource" 13 * table-name="ejb_customer" 14 * abstract-schema-name = "Customer" 15 * 16 * @ejbgen:jndi-name 17 * local="ejb.AutomaticPK_CustomerLocalHome" 18 * 19 * @ejbgen:file-generation local-class = "True" local-class-name="AutomaticPK_CustomerLocal" local-home = "True" local-home-name="AutomaticPK_CustomerHome" remote-class = "False" remote-home = "False" remote-home-name = "CustomerRemoteHome" remote-class-name = "CustomerRemote" value-class = "False" value-class-name = "CustomerValue" pk-class = "True" 20 * 21 * @ejbgen:finder ejb-ql="SELECT OBJECT(o) from Customer as o WHERE o.lastName = ?1" generate-on="Local" signature="AutomaticPK_CustomerLocal findByLastName(java.lang.String lastName)" 22 */ 23 public abstract class Customer_APK extends GenericEntityBean implements EntityBean 24 { 25 26 /** 27 * @ejbgen:cmp-field column="FirstName" 28 * @ejbgen:local-method 29 */ 30 public abstract String getFirstName(); 31 32 /** 33 * @ejbgen:local-method 34 */ 35 public abstract void setFirstName(String arg); 36 37 /** 38 * @ejbgen:cmp-field column="LastName" 39 * @ejbgen:local-method 40 */ 41 public abstract String getLastName(); 42 43 /** 44 * @ejbgen:local-method 45 */ 46 public abstract void setLastName(String arg); 47 48 /** 49 * @ejbgen:cmp-field primkey-field="true" column="Customer_ID" 50 * @ejbgen:local-method 51 */ 52 public abstract Integer getCustomer_ID(); 53 54 /** 55 * @ejbgen:local-method 56 */ 57 public abstract void setCustomer_ID(Integer arg); 58 59 /** 60 * This method 61 */ 62 public java.lang.Integer ejbCreate(java.lang.String FirstName, java.lang.String LastName) 63 { 64 setFirstName(FirstName); 65 setLastName(LastName); 66 67 return null; // FIXME return PK value 68 } 69 70 public void ejbPostCreate(java.lang.String FirstName, java.lang.String LastName) 71 { 72 } 73 } 74`