Class: com.sybase.djc.ant.PersistentObjectProperty (Persistent Object Property) | EAServer 6.3 Help |
---|
Description | This property is used to configure object-relational mapping for a persistent object (entity class) that is generated during deployment of EJB entity beans. |
---|---|
Configuration |
Configuration is achieved using an XML (Ant) configuration script, such as the following: <project name="ejbjar-example-user"> <import file="ant-config-tasks.xml"/> <target name="configure-user"> <setProperties component="ejb.components.example.CustomerInventory"> <persistentObject table="cust_inv" isolationLevel="RepeatableRead" selectWithUpdateLock="true" /> </setProperties> </target> </project>This example assumes the prior deployment of an EJB-JAR file named example.jar. The above script would be placed in file ejbjar-example-user.xml in the config directory of your EAServer installation. To run the script, assuming that the bin directory of your EAServer installation is in the PATH, you would use one of the the following commands: recompile ejbjar-example-user (Windows) recompile.sh ejbjar-example-user (Unix / Linux) Alternatively, the above script can be named sybase-ejbjar-config.xml and placed alongside ejb-jar.xml in the META-INF directory inside an EJB-JAR file (prior to deployment). Note: you can define multiple properties, for multiple components, in the same configuration script. |
Nested Properties | allowLocalCacheReads, allowVerifyWithCache, cacheChildren, cacheLock, cacheLockTimeout, cacheSize, cacheTimeout, dataSource, deferDelete, deferInsert, deferUpdate, deleteStatement, distributedCache, flushOnFind, indexCreator, insertStatement, isolationLevel, keyGenerator, lockDataRows, parentVersion, selectView, selectWithSharedLock, selectWithUpdateLock, table, tableCreator, tableVersion, timestampColumn, touchColumn, updateStatement, verifyStatement, versionColumn |
Property: allowLocalCacheReads (Allow Local Cache Reads) | |
---|---|
Description | When using a distributed cache, this property enables read operations from the local cache (whereas commit-time verify operations and changes are issued to the distributed cache). Use of this property might result in transactions that must to be retried due to commit-time verification failure, however when most access to a given data item is from a single cluster member, verify failures are unlikely and this property may help to improve performance by reducing inter-node communication. |
Only Used If | Property distributedCache is not empty. |
Default Value | false |
Legal Values | false, true |
Property: allowVerifyWithCache (Allow Verify With Cache) | |
---|---|
Description |
When using a cache, depending on the isolationLevel
a commit-time verification query might need be sent to the database. If a database
trigger can be created to notify the cache (before DB transaction commits)
whenever a row is updated or deleted, then full consistency can be guaranteed even
if verification is performed against the cache. If more than one application
server process accesses the database, then either:
This property allows verification against the cache for read-only transactions. Transactions that issue updates will still perform verification queries against the database. The key advantage of this property is to avoid communications with the database server for read-only transactions using cached data, while retaining full consistency. Two mechanisms are available for database triggers to notify the cache when a row is inserted or updated.
Note: the "cache-name" for an entity "MyEntity" in an EJB-JAR named "MyMymodule" is "mymodule.MyEntity". If in doubt, check your server log on startup for "Registering object cache" messages. See also: REST Service. |
Default Value | false |
Legal Values | false, true |
Property: cacheChildren (Cache Children) | |
---|---|
Description | When query methods refer to this entity using the parentVersion property, the query methods must also be explicitly referenced by this entity. The syntax of this property is a comma-separated list of "ChildEntity.QueryName", e.g. "Order.findByCustomer". |
Property: cacheChildren (Cache Children) | |
---|---|
Description | When query methods refer to this entity using the parentVersion property, the query methods must also be explicitly referenced by this entity. The syntax of this property is a comma-separated list of "ChildEntity.QueryName", e.g. "Order.findByCustomer". |
Property: cacheLock (Cache Lock) | |
---|---|
Description | When the name of the selected isolationLevel ends with "Cache", this property determines whether exclusive locks should be used to ensure that only one transaction at a time can access any cache entry. The purpose of this property is to permit the use of caching with entities that have some level of update contention. This property should not be relied upon to ensure exclusive access to the underlying database table rows. It is best used in combination with optimistic concurrency control (versionColumn). |
Default Value | false |
Legal Values | false, true |
Property: cacheLockTimeout (Cache Lock Timeout) | |
---|---|
Description | The number of seconds that a transaction will wait when trying to obtain a lock. If a lock is not acquired in this period, the transaction will be rolled back. |
Only Used If | Property cacheLock has the value "true". |
Default Value | 10 |
Minimum Value | 0 |
Maximum Value | 2147483647 |
Property: dataSource (Data Source) | |
---|---|
Description | Name of the data source for the database in which the table is lcoated. |
Property: deferDelete (Defer Delete) | |
---|---|
Description |
Indicates whether SQL delete statements will be deferred
(and batched) until transaction commit time. Only used if
the data source
is configured to use an optimized driver.
|
Default Value | true |
Legal Values | false, true |
Property: deferInsert (Defer Insert) | |
---|---|
Description |
Indicates whether SQL insert statements will be deferred
(and batched) until transaction commit time. Only used if
the data source
is configured to use an optimized driver.
|
Default Value | true |
Legal Values | false, true |
Property: deferUpdate (Defer Update) | |
---|---|
Description |
Indicates whether SQL update statements will be deferred
(and batched) until transaction commit time. Only used if
the data source
is configured to use an optimized driver.
|
Default Value | true |
Legal Values | false, true |
Property: distributedCache (Distributed Cache) | |
---|---|
Description | Name of a distributed cache to be used if the isolationLevel property is cache-enabled. Distributed caches generally will not perform as well as local caches, but offer the advantages of being able to hold more objects and being able to survive the failure of cluster members. |
Property: flushOnFind (Flush On Find) | |
---|---|
Description |
Indicates whether deferred SQL delete , insert and update
statements should be flushed to the database whenever a
query method
is invoked. See also:
deferDelete,
deferInsert,
deferUpdate.
|
Default Value | true |
Legal Values | false, true |
Property: indexCreator (Index Creator) | |
---|---|
Description |
A SQL statement to be used for creating any non-primary
indexes for the database table. If this requires multiple statements,
they should be separated by double-semicolon ";;".
Example: "create index my_cust_name_index on my_cust (cust_name)" Note: this property is only used if the persistence manager also creates the table. See also: tableCreator. |
Property: isolationLevel (Isolation Level) | |
---|---|
Description |
Specifies a default logical isolation level for all queries
issued by the persistence manager for this entity class. A
logical isolation level is distinct from the
sqlIsolationLevel
that is applied to any JDBC database connections that
are participating in the transaction. Typically the
SQL isolation level is ReadCommitted, and for some entity classes
or query methods a higher isolation level is requested.
This can be overridden (raised or lowered) on a per-query basis by using the isolationLevel query method property. Note that if the isolation level ends with "Cache", it applies only to the findByPrimaryKey query. Any other queries will use a default isolation level without the "Cache" suffix. Use explicit per-query isolation levels to enable caching for queries other than findByPrimaryKey. The available isolation levels and their interpretations are:
|
Property: lockDataRows (Lock Data Rows) | |
---|---|
Description | Enable this if you using a Sybase database and you want the "lock datarows" clause to be added to the table creation SQL (only used for automatic table creation). |
Default Value | false |
Legal Values | false, true |
Property: parentVersion (Parent Version) | |
---|---|
Description |
Allows cached entities to be associated with a particular
version of a "parent" object, while guaranteeing a high level
of transactional consistency. The syntax of this property is
"ParentEntity[ForeignKey].version",
The parent entity refers to another entity which uses
versionColumn.
The foreign key is a persistent field of the current entity which
is assumed to be the primary key for the corresponding parent object.
This is particularly useful in combination with an isolationLevel
of RepeatableReadWithCache or SerializableWithCache .
As an example, a foreign key field "custId" declared on an "Order" entity could be associated with a parent "Customer" entity by using the parent version expression "Customer[custId].version". |
Property: selectView (Select View) | |
---|---|
Description |
If persistent fields of the entity class are mapped to multiple tables,
the persistence manager will create a view that brings together all of the
persistent fields from the various tables. You can use this
property to specify the name of the generated database view.
By default, the view name is "cmp_sv_table", where
table is the main table name.
See also: table. |
Property: selectWithSharedLock (Select With Shared Lock) | |
---|---|
Description |
Enable this to give a hint for the persistence manager to acquire
a shared lock on each row retrieved from the database table.
Note: if the selected isolationLevel does not require that rows be protected from concurrent updates, this property may be ignored. You should therefore always use the isolationLevel property to express your data consistency requirements. |
Default Value | false |
Legal Values | false, true |
Property: selectWithUpdateLock (Select With Update Lock) | |
---|---|
Description |
Enable this to give a hint for the persistence manager to acquire
an exclusive lock on each row retrieved from the database table.
Note: if the selected isolationLevel does not require that rows be protected from concurrent updates, this property may be ignored. You should therefore always use the isolationLevel property to express your data consistency requirements. See also: touchColumn. |
Default Value | false |
Legal Values | false, true |
Property: table (Table) | |
---|---|
Description | Name of the database table for this entity class. If the database requires quoted identifiers, this should be enabled using the useQuotedIdentifiers property. If this entity class is mapped to multiple tables, use this property to name the "main" table, and use the table persistent field property or the joinTable persistent field property to specify column mapping information for secondary or join tables. |
Property: tableCreator (Table Creator) | |
---|---|
Description |
A SQL statement to be used for creating the database
table and its primary index if the
table doesn't already exist. If this requires multiple statements,
they should be separated by double-semicolon ";;".
Example: "create table my_cust (cust_id integer not null, cust_balance decimal(20,4) not null, cust_name varchar(50) not null, primary key (cust_id))" See also: indexCreator. |
Property: tableVersion (Table Version) | |
---|---|
Description |
The name of a version table and version column (e.g. "ref_tv.version")
representing a single row which holds a version number that is
incremented by the persistence manager whenever any row is
deleted, inserted or updated in the database
table. This is useful for reducing the
overheads of version checking when using optimistic concurrency control
for database tables that are infrequently updated. It is particularly useful in
combination with an isolationLevel
of RepeatableReadWithCache or SerializableWithCache .
If, due to triggers or other database-specific mechanisms, this "table version" column is also updated when ad-hoc updates are made to the database table by a client which is not performing version management, then the trigger or other mechanism must be disabled when the persistence manager is in use. This disabling is needed to prevent an update issued by the persistence manager resulting in a double increment of the "table version" column (one time by the persistence manager and one time by the database server). See also: disableTriggers (Data Source Property). |
Property: timestampColumn (Timestamp Column) | |
---|---|
Description | The name of a column that holds a row timestamp which is automatically set (or changed) by the database server whenever a row is inserted (or updated). |
Property: touchColumn (Touch Column) | |
---|---|
Description | The name of an integer-typed database column that can be "touched" (updated) in order to acquire an exclusive lock on a database row. This is only needed if you use selectWithUpdateLock and the database does not have builtin support for acquiring exclusive locks at select time (e.g. Sybase ASE). |
Property: updateStatement (Update Statement) | |
---|---|
Description |
A SQL statement to be used for updating a row in the database
table for this entity. If this requires multiple statements,
they should be separated by double-semicolon ";;". Persistent
fields may be referenced in the SQL statement as ":myFieldName",
":old.myFieldName", or ":new.myFieldName". If no SQL statement is specified,
the persistence manager will generate a default SQL statement.
Example: Note: it is permitted to use the JDBC "{call ...}" escape syntax to utilize database stored procedures. |
Property: verifyStatement (Verify Statement) | |
---|---|
Description |
A SQL statement to be used for verifying that a row in the database
table for this entity has not changed. If this requires multiple statements,
they should be separated by double-semicolon ";;". Persistent
fields may be referenced in the SQL statement as ":myFieldName",
or ":old.myFieldName". If no SQL statement is specified,
the persistence manager will generate a default SQL statement.
Example: Note: it is permitted to use the JDBC "{call ...}" escape syntax to utilize database stored procedures. |
Property: versionColumn (Version Column) | |
---|---|
Description |
The name of an integer-typed column
that holds a row version which is automatically set (or changed)
by the persistence manager whenever a row is inserted (or updated).
If, due to triggers or other database-specific mechanisms, this version column is also updated when ad-hoc updates are made to the database table by a client which is not performing version management, then the trigger or other mechanism must be disabled when the persistence manager is in use. This disabling is needed to prevent an update issued by the persistence manager resulting in a double increment of the version column (one time by the persistence manager and one time by the database server). See also: disableTriggers (Data Source Property). |