类 AliasToBeanResultTransformer

  • 所有已实现的接口:
    Serializable, ResultTransformer, TupleSubsetResultTransformer

    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.

     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();
     

    StudentDTO dto = (StudentDTO)resultWithAliasedBean.get(0);

    作者:
    max
    另请参阅:
    序列化表格
    • 构造器详细资料

      • AliasToBeanResultTransformer

        public AliasToBeanResultTransformer​(Class resultClass)
    • 方法详细资料

      • isTransformedValueATupleElement

        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 tuple
        tupleLength - - the number of elements in the tuple
        返回:
        true, if the transformed value is a single element of the tuple; false, otherwise.
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 Object