hql - Hibernate Criteria: Projection with TransferObject -
how convert hql code below hibernate criteria query?
select new com.project.to.personto( person.firstname, person.lastname ) person person
try below :-
criteria criteria = session.createcriteria(person.class); criteria.setprojection(projections.projectionlist().add(projections.property("firstname"), "firstname") .add(projections.property("lastname"), "lastname")) .setresulttransformer(new aliastobeanresulttransformer(personto.class));
Comments
Post a Comment