public class AliasToBeanResultTransformer extends AliasedTupleSubsetResultTransformer
Result transformer that allows to transform a result to a user specified class which will be populated via setter methods or fields matching the alias names. <p/> <pre> List resultWithAliasedBean = s.createCriteria(Enrolment.class) .createAlias("student", "st") .createAlias("course", "co") .setProjection( Projections.projectionList() .add( Projections.property("co.description"), "courseDescription" ) ) .setResultTransformer( new AliasToBeanResultTransformer(StudentDTO.class) ) .list(); <p/> StudentDTO dto = (StudentDTO)resultWithAliasedBean.get(0); </pre>
Constructor and Description |
---|
AliasToBeanResultTransformer(Class resultClass) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isTransformedValueATupleElement(String[] aliases,
int tupleLength)
When a tuple is transformed, is the result a single element of the tuple?
|
Object |
transformTuple(Object[] tuple,
String[] aliases)
Tuples are the elements making up each "row" of the query result.
|
includeInTransform
transformList
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
transformList
public AliasToBeanResultTransformer(Class resultClass)
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength)
TupleSubsetResultTransformer
When a tuple is transformed, is the result a single element of the tuple?
aliases
- - the aliases that correspond to the tupletupleLength
- - the number of elements in the tuplepublic Object transformTuple(Object[] tuple, String[] aliases)
ResultTransformer
Tuples are the elements making up each "row" of the query result. The contract here is to transform these elements into the final row.
transformTuple
in interface ResultTransformer
transformTuple
in class BasicTransformerAdapter
tuple
- The result elementsaliases
- The result aliases ("parallel" array to tuple)Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.