Red Hat APPLICATION SERVER - JONAS Manual page 92

Jonas
Hide thumbs Also See for APPLICATION SERVER - JONAS:
Table of Contents

Advertisement

84
return null;
}
If nothing else is specified and the JOnAS default CMP 2 database mapping is used, the JOnAS
container generates a database column with the name
to specify in the JOnAS-specific Deployment Descriptor the name of the column that will be used
to store the PK value in the table. You can do this as follows using the specific
name
element (this technique is necessary for CMP2 legacy and for CMP1):
JOnAS-specific deployment descriptor:
jonas-ejb-jar xmlns="http://www.objectweb.org/jonas/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.objectweb.org/jonas/ns
http://www.objectweb.org/jonas/ns/jonas-ejb-jar_4_0.xsd"
jonas-entity
ejb-name AddressEJB /ejb-name
jdbc-mapping
jndi-name jdbc_1 /jndi-name
automatic-pk-field-name FieldPkAuto /automatic-pk-field-name
/jdbc-mapping
/jonas-entity
8.4.1.1.2. Method 2: CMP Field as Automatic Primary Key (from JOnAS 3.3.x)
The idea here is to declare a typical PK CMP field of type
By doing this, the field will no longer appear in
generated by the container at the EJB instance-creation time. However, it is still a cmp field, with
getter/setter methods, and is accessible from the application.
8.4.1.1.2.1. Method 2 Example:
In the standard deployment descriptor, there is a typical primary key definition:
entity
...
prim-key-class java.lang.Integer /prim-key-class
cmp-field
primkey-field id /primkey-field
In the JOnAS-specific deployment descriptor, specify that this PK is automatic:
jonas-entity
...
jdbc-mapping
automatic-pk true /automatic-pk
field-name id /field-name
Chapter 8. Developing Entity Beans
to handle this PK. However, it is possible
JPK_
java.lang.Integer
methods and its value will be automatically
create
/cmp-field
automatic-pk-field-
as
.
automatic

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the APPLICATION SERVER - JONAS and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Application server

Table of Contents