Our CMP implementation is simply a thin layer over JPA. For each CMP
entity, we create a JPA entity, and for each CMP or CMR field, we
create a field in the JPA entity. The name of the entity is either
the abstract schema name of the CMP entity as declared in the ejb-
jar.xml file, or if the abstract schema name is not declared, it is
the ejb name processed with the following code:
ejbName.trim().replaceAll("[ \\t\\n\\r-]+", "_");
Basically, that is all sequences of white space and '-' replaced with
a single underscore.
Now that you know how we map a CMP entity to a JPA entity, following
the default mapping rules in the JPA specification, you can determine
the mapping for your CMP beans... but that would be work, so I'll
just repeat the rules here :) Each JPA entity is mapped to a table
with the same name as the entity, and each field (id, basic,
association) is mapped to a column of the same name. Pretty simple.
-dain
On Feb 17, 2007, at 9:12 AM, Manu George wrote:
Hi,
As per my knowledge, currently in openejb for mapping of the ejb
fields to the database columns we use the jpa.mapping.xml file. Do we
still need the cmp.mapping.xml?
Secondly does oejb have the ability to automatically do the mapping
during deployment. eg If the user puts the <automap> tag in the dd
then openejb should try to auto map during deployment. Probably the
table names need to be mapped by to the EJB by the user if they are
different from the ejb names. We can also specify whether the mapping
should be by name (ejb fields and table fields)or by type.
This should enable openejb to generate the mapping automatically
instead of the user specifying them.
Some app servers provide this functionality. Is a similar feature
there in OEJB?
Regards
Manu