Query like this :
query1 = with codeList (bId, code) as ( select id, listagg(code, ',') ........)
select {A.*}, {B.*}, CL.code as codeListName from
tableA A left join tableB B on A.id = B.id
left join codeList CL on A.id = CL.bId
Result of the query would be like List of following values:
a.id, a.name, a.code, b.id, b.desc, b.addr , name
Can you let me know how to get the values using
query.addEntity("A", TableA.class).addJoin("B", "A.tableB").addScalar("codeListName", StryingType.Instance)
/// how to get the "codeListName" here? this addScalar is not working. Is this correct approach?
SQLQuery query = session.createSQLQuery(query1);
List<Object[]> rows = query .list();