i have a orders table, order_status table and a system_codes table.
one order will have a 1 order_status. there is one to one between these 2 tables.
i have a one to one between order_status ---> system_codes. every order status will have a unique system_code (in fact the order_status and system_code is the the same)
there is no direct relationship between order and system_codes. So, my question is how to access a column from system_codes table using projections
some code i have is as follows.
Code:
ProjectionList columnList = Projections.projectionList();
columnList.add(Projections.property("id"), "id");
columnList.add(Projections.property("orderStatus"), "orderStatus");
columnList.add(Projections.property("orderTodate"), "orderTodate");
crit.setProjection(columnList);
crit.createAlias("lineItems", "li");
columnList.add(Projections.property("li.id"), "itemId");
columnList.add(Projections.property("li.itemStatus"), "itemStatus");
columnList.add(Projections.property("li.procPriority"), "procPriority");
columnList.add(Projections.property("li.activitySite"), "site");
crit.createAlias("li.lineSources", "lsrc");
columnList.add(Projections.property("lsrc.datasetName"), "dataset");
columnList.add(Projections.property("lsrc.datatypeName"), "datatype");
crit.createAlias("orderEmails", "orderemails");
columnList.add(Projections.property("orderemails.EmailAddress"), "email");
crit.createAlias("userId", "usr");
columnList.add(Projections.property("usr.lastName"), "user");
crit.setResultTransformer(Transformers.aliasToBean(OrdersCopa.class));
return crit.list();