@ejb.persistence (method)
Scope: method
Multiplicity
(0..1): You can use this tag zero or one time in the Java source file.
Purpose
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 will create the CMP field X in the generated CMP layer of type Foo, and concrete implementations of the getX and setX methods. For BMP, it will generate 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. Note that 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.
.
Parameters
Parameter Type Applicability Description Mandatory column-name text Declares the column-name that the CMP field will be 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 will be 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:
- ARRAY
- BIGINT
- BINARY
- BIT
- BLOB
- BOOLEAN
- CHAR
- CLOB
- DATALINK
- DATE
- DECIMAL
- DISTINCT
- DOUBLE
- FLOAT
- INTEGER
- JAVA_OBJECT
- LONGVARBINARY
- LONGVARCHAR
- NULL
- NUMERIC
- OTHER
- REAL
- REF
- SMALLINT
- STRUCT
- TIME
- TIMESTAMP
- TINYINT
- VARBINARY
- VARCHAR
The default value is
- VARCHAR
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:
- true
- false
false
Parent topic
EJB Tags
Related reference
@ejb.bean
@ejb.create-method
@ejb.ejb-external-ref
@ejb.ejb-ref
@ejb.env-entry
@ejb.facade
@ejb.facade-method
@ejb.finder
@ejb.home
@ejb.home-method
@ejb.interface
@ejb.interface-method
@ejb.permission
@ejb.persistence
@ejb.pk
@ejb.pk-field
@ejb.relation
@ejb.remote-facade
@ejb.resource-env-ref
@ejb.resource-ref
@ejb.security-identity
@ejb.security-role-ref
@ejb.select
@ejb.session
@ejb.transaction
@ejb.util
@ejb.value-object
@ejb.value-object-method