Approach 1

In the custom model package structure, model an extension entity which extends the Curam-shipped entity (if such an extension does not already exist).

In the extension entity, model a stereotyped retrieval operation (read/readmulti/nsread/nsmulti/ns). The retrieval operation must return the full generated Dtls struct for the Curam-shipped entity (or the corresponding DtlsList struct for multi operations); moreover, any hand-crafted SQL for the operation must correctly populate every field in the return struct, including versionNo (if present). Note that hand-crafted is free to join to custom database tables if necessary to filter results (but not to return data from custom database tables).

In the custom code package structure, create a hand-crafted custom DAO interface/implementation to house the new search operations. Note that unlike standard DAO interface/implementations, your hand-crafted classes will not extend PI-supplied infrastructure classes.

In your custom DAO interface, declare your new search methods.

In your custom DAO implementation, implement your new search methods. The methods will delegate to the generated code for your custom entity extension. Note that there is no generated adapter support for operations contributed by extension classes, and so your implementation will need to provide the exception wrapping and struct mapping traditionally performed by the generated adapters.

In your client code which requires to execute your custom search, inject an instance of your new custom DAO interface and use your new search methods to return instances of the Curam-shipped interface for the entity's service layer class. You may access the entity's data via the accessor (getter) methods on the service layer class, including any derived data, and access any side-saddle tables using the entity's context, just as you would for instances returned by the Curam-shipped DAO interface.

(Optional) If you find that your client code ends up having to inject instances of both the Curam-shipped DAO interface and your new custom DAO interface, you might consider mimicking some or all of the Curam-shipped DAO methods on your new custom interface. The implementation of these mimicked methods may delegate to the Curam-shipped DAO implementation. Curam does not recommend that you allow your new custom DAO interface to extend the Curam-shipped DAO interface, nor that you allow your new custom DAO implementation to subclass the Curam-shipped DAO implementation, as to do so may present future upgrade difficulties.