| 1 | #copyrightHeader() |
|---|
| 2 | |
|---|
| 3 | package ${package}; |
|---|
| 4 | |
|---|
| 5 | #set($imports = $cmpgen.buildBeanImportList($stmt)) |
|---|
| 6 | #foreach($import in $imports) |
|---|
| 7 | import ${import}; |
|---|
| 8 | #end |
|---|
| 9 | |
|---|
| 10 | /** |
|---|
| 11 | * $baseName Entity Bean. |
|---|
| 12 | * Generated by Phoenix CMP Generator II $cmpgen.getVersion() |
|---|
| 13 | * |
|---|
| 14 | * @author fawkeZ (jCoderZ.org) |
|---|
| 15 | * |
|---|
| 16 | * @ejb.bean name="${baseName}" type="CMP" jndi-name="${baseName}" |
|---|
| 17 | * cmp-version="2.x" use-soft-locking="false" |
|---|
| 18 | * schema="$cmpgen.sqlNameToJavaName($stmt.getTableName())" |
|---|
| 19 | #if($cmpgen.checkIfHelperRequired($stmt)) |
|---|
| 20 | * @ejb.data-object extends="${package}.${baseName}TypeConverter" |
|---|
| 21 | #end |
|---|
| 22 | * @ejb.persistence table-name="$stmt.getTableName()" |
|---|
| 23 | * @ejb.resource-ref res-ref-name="${datasource}" |
|---|
| 24 | * res-type="javax.sql.DataSource" |
|---|
| 25 | * res-auth="Container" |
|---|
| 26 | * |
|---|
| 27 | * FIXME: please adapt the transaction xdoclet tag! |
|---|
| 28 | * @ejb.transaction type="Required" |
|---|
| 29 | * |
|---|
| 30 | #if(! $stmt.isSkipAppserverSupport()) |
|---|
| 31 | * Application Server Support |
|---|
| 32 | * @weblogic.data-source-name "${datasource}" |
|---|
| 33 | * |
|---|
| 34 | * @weblogic.enable-call-by-reference True |
|---|
| 35 | #if($stmt.isOptimisticVersionCount()) |
|---|
| 36 | * @weblogic.persistence verify-columns="Version" |
|---|
| 37 | * optimistic-column="version_count" |
|---|
| 38 | #else |
|---|
| 39 | * @weblogic.persistence verify-columns="Read" |
|---|
| 40 | #end |
|---|
| 41 | * delay-updates-until-end-of-tx="True" |
|---|
| 42 | * @weblogic.cache concurrency-strategy="Optimistic" |
|---|
| 43 | * @weblogic.delay-database-insert-until ejbCreate |
|---|
| 44 | * |
|---|
| 45 | #end |
|---|
| 46 | #if($stmt.getAdditionalJavadoc()) |
|---|
| 47 | * |
|---|
| 48 | $stmt.getAdditionalJavadoc() |
|---|
| 49 | * |
|---|
| 50 | #end |
|---|
| 51 | ## * @jcoderz.ds-jndi-name ds-jndi-name="${datasource}" |
|---|
| 52 | ## * @jcoderz.dbms-table dbms-table="${$stmt.getTableName()}" |
|---|
| 53 | ## * @jcoderz.concurrency-control concurrency-control="OPTIMISTIC" |
|---|
| 54 | */ |
|---|
| 55 | public abstract class ${baseName}Bean |
|---|
| 56 | #if($cmpgen.checkIfHelperRequired($stmt)) |
|---|
| 57 | extends ${baseName}TypeConverter |
|---|
| 58 | #end |
|---|
| 59 | implements javax.ejb.EntityBean |
|---|
| 60 | { |
|---|
| 61 | /** The name of the DB table which this entity represents. */ |
|---|
| 62 | public static final String TABLE_NAME = "$stmt.getTableName().toUpperCase()"; |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | * Create this Entity bean from its data object. |
|---|
| 66 | * @param data data object containing the entity |
|---|
| 67 | * @return primary key |
|---|
| 68 | * @throws CreateException if the container encounters a |
|---|
| 69 | * problem during bean creation. |
|---|
| 70 | * @ejb.create-method |
|---|
| 71 | */ |
|---|
| 72 | public ${baseName}PK ejbCreate (${baseName}Data data) |
|---|
| 73 | throws CreateException |
|---|
| 74 | { |
|---|
| 75 | #set($pkColCount = 0) |
|---|
| 76 | #foreach ($column in $stmt.getColumns())## |
|---|
| 77 | #computeFields() |
|---|
| 78 | #if($column.isPrimaryKey()) |
|---|
| 79 | $simpleSetterName(data.${simpleGetterName}()); |
|---|
| 80 | #set($pkColCount = $pkColCount + 1) |
|---|
| 81 | #end |
|---|
| 82 | #end |
|---|
| 83 | setData(data); |
|---|
| 84 | return new ${baseName}PK( |
|---|
| 85 | #set($count = 1) |
|---|
| 86 | #foreach ($column in $stmt.getColumns()) |
|---|
| 87 | #computeFields() |
|---|
| 88 | #if ($column.isPrimaryKey()) |
|---|
| 89 | ${simpleGetterName}()#if($count < $pkColCount),#end |
|---|
| 90 | |
|---|
| 91 | #set($count = $count + 1) |
|---|
| 92 | #end |
|---|
| 93 | #end |
|---|
| 94 | ); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /** |
|---|
| 98 | * Post-Create this Entity bean from its data object. |
|---|
| 99 | * @param data data object containing the entity |
|---|
| 100 | */ |
|---|
| 101 | public void ejbPostCreate (${baseName}Data data) |
|---|
| 102 | { |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | #foreach($column in $stmt.getColumns()) |
|---|
| 106 | #computeFields() |
|---|
| 107 | #if($column.getLoadMethod()) |
|---|
| 108 | #simpleBeanGetter(false) |
|---|
| 109 | |
|---|
| 110 | #simpleSetter(false) |
|---|
| 111 | |
|---|
| 112 | #elseif($column.isSkipInInterface()) |
|---|
| 113 | #simpleBeanGetter(false) |
|---|
| 114 | |
|---|
| 115 | #simpleSetter(false) |
|---|
| 116 | |
|---|
| 117 | #else |
|---|
| 118 | #simpleBeanGetter(true) |
|---|
| 119 | |
|---|
| 120 | #simpleSetter(true) |
|---|
| 121 | |
|---|
| 122 | #end |
|---|
| 123 | #end |
|---|
| 124 | /** |
|---|
| 125 | * Returns the data of the entity. |
|---|
| 126 | * @return a data object representing the entity |
|---|
| 127 | * @ejb.interface-method |
|---|
| 128 | */ |
|---|
| 129 | public abstract ${baseName}Data getData (); |
|---|
| 130 | |
|---|
| 131 | /** |
|---|
| 132 | * Sets the data of the entity except for the primary key field(s). |
|---|
| 133 | * @param data data object representing the entity. |
|---|
| 134 | * @ejb.interface-method |
|---|
| 135 | */ |
|---|
| 136 | public abstract void setData (${baseName}Data data); |
|---|
| 137 | } |
|---|