Created
February 25, 2014 17:43
-
-
Save marti1125/9213979 to your computer and use it in GitHub Desktop.
hibernate group
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<EventualidadDto> sumaTotalDeHoras = ((Session)JPA.em().getDelegate()).createCriteria(Eventualidad.class) | |
.setProjection( Projections.projectionList() | |
.add(Projections.sqlGroupProjection("sum({alias}.totalDeHoras) as sumaDeHoras", "{alias}.docente_codigo,{alias}.tipoEventualidad_id", | |
new String[]{"sumaDeHoras"}, new Type[] {DoubleType.INSTANCE}),"sumaDeHoras")) | |
.add( Restrictions.sqlRestriction(" ( {alias}.docente_codigo = ? ) ", new String[] {r.codigo}, new Type[] {StringType.INSTANCE})) | |
.add( Restrictions.sqlRestriction(" ( {alias}.tipoEventualidad_id = ? ) ", new Long[] {tipoEventualidad.id}, new Type[] {LongType.INSTANCE})) | |
.setResultTransformer(new AliasToBeanResultTransformer(EventualidadDto.class)).list(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment