This tag provides information about the persistence of the fields of a Container-managed Persistence (CMP) Entity bean. Use this for methods with the following patterns: public abstract Foo getX(), public abstract boolean isX(), and public abstract void setX(Foo newVal). This creates the CMP field X in the generated CMP layer of type Foo, and concrete implementations of the getX and setX methods. For BMP, it generates getX and setX methods that keep track of a dirty flag (so that ejbStore is only called if necessary).
If the type is boolean, you can prefix the get method with is instead of get. If you do not define the setter method, no setter method is generated for the concrete BMP/CMP class (concrete CMP class is generated only in EJB 1.1 or EJB 2.0, using CMP 1.x). This is useful for cases where, for example, nothing is set programmatically but via external sources, such as a stored procedure. Some application servers require jdbc-type and sql-type to be applied together to work correctly; consult the respective subtask for your application server. Applies to EJB entity bean fields, specifically, on the getter methods of the persistent fields.
.| Parameter | Type | Applicability | Description | Mandatory |
|---|---|---|---|---|
| column-name | text | Declares the column-name that the CMP field is mapped to. | false | |
| jdbc-type | text | Declares the JDBC Type. Its value must be one
of the fields of java.sql.Types (for example, BIT,
CHAR). This JDBC type is used by the CMP provider to determine which
method to call on PreparedStatement and ResultSet for INSERT, UPDATE,
and SELECT queries. You must specify one of the following
attributes:
|
false | |
| sql-type | text | Declares the actual type of the field in the database. This value will only be used when the CMP container creates your table (if possible). | false | |
| read-only | Boolean | Indicates that a field is read only. You must
specify one of the following attributes:
|
false |