hibernate - JPA Criteria Join did not give me a list -
hello i'm doing advanced search query using criteria , have this
criteriabuilder criteriabuilder = entitymanager.getcriteriabuilder(); criteriaquery<tuple> criteriaquery = criteriabuilder.createtuplequery(); root<event> eventroot = criteriaquery.from(event.class); join<event,community> communityjoin = eventroot.join("community", jointype.left); join<event,user> user = eventroot.join("user", jointype.left); join<event,device> device = eventroot.join("device", jointype.left); join<event,list<auditlog>> auditlogs = eventroot.join("auditlogs", jointype.left);
i have can see one-to-many relation auditlog entity (mapped auditlogs). i'm doing selection this
selections.add(user.alias("user")); selections.add(device.alias("device")); selections.add(auditlogs.alias("auditlogs"));
i'm getting result tuple list
query query = entitymanager.createquery(criteriaquery); list<tuple> tuples = (list<tuple>) query.getresultlist();
the problem whem i'm getting auditlogs tuple i'm getting auditlog object instead of list of auditlog
tuples.get(0).get("auditlogs")
am doing wrong?. don't know why can't have result list auditlog.
Comments
Post a Comment