I have a class CTMEntity which have a composite id with two fields/columns (ctmEntityId and ctmEntitySys). This class will have fields coming from two tables (say ctmentity, ctmstatus). ctmstatus table also have the same composite id (ctmEntityId and ctmEntitySys) with one-to-one relation with ctmentity. For good reasons, we can not merge the two tables. And also I have to keep CTMEntity as a flat object, that means, CTMEntity can not have a object reference of object CTMStatus. It rather has to have fields from CTMStatus. So, I can not create an object CTMStatus. Here is sample of the class.
public class CtmEntity {
private int ctmEntityId; private String ctmEntitySys; private .............. private .............. private .............. //fields coming fom ctmstatus table, for same ctmEntityId,ctmEntitySys private int statusId; private String statusCatgy; private String statusDesc; private .............. private .............. }
Please suggest me, how should I create my mapping to have fields populated from two tables? I saw join, but as per my understanding join does not work on composite key. Please advice asap.
Thanks Abhishek
|