/** Entity */
public class MyJoinEntity {
private Long stepId;
private String orderId;
public Long getStepId() {
return stepId;
}
public void setStepId(Long val) {
stepId = val;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String val) {
orderId = val;
}
}
/** Usage */
...
StringBuilder hql = new StringBuilder("select ho.orderId as orderId "); // set aliases for all properties
hql.append(",hos.id as stepId ");
hql.append("from " + DBLayer.DBITEM_HISTORY_ORDER).append(" ho ");
hql.append(",").append(DBLayer.DBITEM_HISTORY_ORDER_STEP).append(" hos ");
hql.append("where ho.id=hos.orderId ");
// Query definition with JobScheduler 1.12.x, 1.13.x
Query<MyJoinEntity> query = session.createQuery(hql.toString());
query.setResultTransformer(Transformers.aliasToBean(MyJoinEntity.class)); // pass MyJoinEntity as resultType
// Query definition with JobScheduler JS7
// Query<MyJoinEntity> query = session.createQuery(hql.toString(), MyJoinEntity.class); // pass MyJoinEntity as resultType
List<MyJoinEntity> result = session.getResultList(query);
for (MyJoinEntity item : result) {
LOGGER.info(SOSHibernate.toString(item));
}
...