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.
|
includeInTransformtransformListclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waittransformListpublic AliasToBeanResultTransformer(Class resultClass)
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength)
TupleSubsetResultTransformerWhen 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)
ResultTransformerTuples 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 ResultTransformertransformTuple in class BasicTransformerAdaptertuple - The result elementsaliases - The result aliases ("parallel" array to tuple)Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.