The solution

You must:

Model your database table in the Cúram model

You must model your database table in the Cúram model using Cúram's modeling tools.

Ensure that:
  • you model a single primary key attribute for the table, which unwinds to a long;
  • you model a standard read operation;
  • any write operations that you require to model are standard write operations (insert, modify and remove);
  • if you model a standard insert operation, that it specifies an AUTO_ID strategy (if required);
  • if your entity supports optimistic locking (i.e. your entity specifies ALLOW_OPTIMISTIC_LOCKING=yes) and if you model a standard modify operation, that optimistic locking is switched on for this operation (i.e. your modify operation specifies OPTIMISTIC_LOCKING=yes);
  • if your entity supports any non-standard read operations, then you model a struct to hold the search criteria and specify the return struct as the full Dtls struct;
  • if your entity supports any search operations, then you model a struct to hold the search criteria (you do not need specify any return struct - by default the DtlsList struct will be used); and
  • if your entity supports logical deletes, then you model a recordStatus attribute (using the RECORD_STATUS_CODE domain).
Do not model:
  • any non-stereotyped operations;
  • any non-standard write operations;
  • any standard write operations which are not required (e.g. remove is only rarely required);
  • any read or search operations which return anything other than the full Dtls or DtlsList struct; nor
  • any pre- or post- exit points.

Extract and generate your model using the standard command-line tools.

Create an adapter for generated data access methods

You must create an adapter which wraps the generated code for reading, searching and writing database rows.

The Persistence Infrastructure includes a code generator which generates adapter code using information extracted from the Cúram model. To generate a new adapter, add the name of your database table to the file EJBServer/components/<your component>/properties/adapters.properties.

The adapter code generator runs automatically as part of the server build scripts.