lundi 4 juillet 2016

Typed Query in HQL

i am trying fetch particular column in "AResult" entity class and i am trying to do sorting with DESC based on the date in "Result" entity class.

public Class AResult{
    private List<Result> cResultList;
    private Integer active;
    private String citizenID;
    private Double resultRefValue;


    public AResult(Double resultRefValue,Collection<Result> cResultList){
        this.resultRefValue=resultRefValue;
        this.cResultList=(List)cResultList;

    }
    }

    public Result {
        private String name;
        private Date createdDate;
        private Date resultDate;

    }

i am executing below query,

String Query="SELECT NEW AResult(r.resultRefValue,,r.citizenActualResultList) from AResult r where r.active <> 0 AND r.citizenID = :cid  ORDER BY r.Result.resultDate DESC";
    TypedQuery<AResult> citizenD = em.createQuery(Query, AResult.class);

    citizenD.setParameter("cid", ai.getCitizenId());
    List<AResult> aResult=citizenD.getResultList();

i am getting error, when getResulList() is excute(its throws inner join error).

Aucun commentaire:

Enregistrer un commentaire