Defining your “abstract persistence schema” (virtual fields aren’t enough)

To define persistent fields and relationships, you need to create an abstract persistence schema. Defining the virtual fields isn’t enough. Your abstract persistence schema is a combination of your virtual fields in your bean class, plus some things you write in the deployment descriptor.

The way you describe CMP fields in the DD is simple and straightforward. With CMR, you’ll have to do a little more to set things up, including describing the multiplicity for each of the two participants in a relationship.

But we’ll get to CMR fields in just a minute. For now, we’ll start with just CMP fields.

An abstract persistent schema is a combination of some stuff you put in the deployment descriptor, plus your abstract getters and setters.

Together, they tell the Container how to manage your bean’s persistence, including both persistent FIELDS (called CMP fields) and persistent RELATIONSHIPS (called CMR fields).

The Container needs these TWO things to know you have a CMP field “title”

image with no caption

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.