Package org.hibernate.transform

Examples of org.hibernate.transform.AliasToBeanResultTransformer


  public void testSerializedEqualityResultTransformer() throws Exception {
    // settings are lazily initialized when calling transformTuple(),
    // so they have not been initialized for the following test
    // (it *should* be initialized before creating a QueryKey)
    doResultTransformerTest( new AliasToBeanResultTransformer( AClass.class ), false );

    // initialize settings for the next test
    AliasToBeanResultTransformer transformer = new AliasToBeanResultTransformer( AClass.class );
    transformer.transformTuple(
        new Object[] { "abc", "def" },
        new String[] { "propAccessedByField", "propAccessedByMethod" }
    );
    doResultTransformerTest( transformer, false );

View Full Code Here


    doTest( buildBasicKey( CacheableResultTransformer.create( null, new String[] { "a", null }, new boolean[] { true, true } ) ) );
  }

  public void testSerializedEqualityWithTupleSubsetResultTransfprmer() throws Exception {
    doTestWithTupleSubsetResultTransformer(
        new AliasToBeanResultTransformer( AClass.class ),
        new String[] { "propAccessedByField", "propAccessedByMethod" }
    );
    doTestWithTupleSubsetResultTransformer( AliasToEntityMapResultTransformer.INSTANCE, new String[] { "a", "b" } );
    doTestWithTupleSubsetResultTransformer( DistinctRootEntityResultTransformer.INSTANCE, new String[] { "a", "b" } );
    doTestWithTupleSubsetResultTransformer( PassThroughResultTransformer.INSTANCE, new String[] { "a", "b" } );
View Full Code Here

    doTest( buildBasicKey( PassThroughResultTransformer.INSTANCE ) );

    // settings are lazily initialized when calling transformTuple(),
    // so they have not been initialized for the following test
    // (it *should* be initialized before creating a QueryKey)
    doTest( buildBasicKey( new AliasToBeanResultTransformer( AClass.class ) ) );

    // initialize settings for the next test
    AliasToBeanResultTransformer transformer = new AliasToBeanResultTransformer( AClass.class );
    transformer.transformTuple(
        new Object[] { "abc", "def" }
        new String[] { "propAccessedByField", "propAccessedByMethod" } );
    doTest( buildBasicKey( transformer ) );
  }
View Full Code Here

        criteria.add(Restrictions.ge("date", startDate));
        criteria.add(Restrictions.le("date", endDate));

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.count("id").as("number")).add(Projections.groupProperty("status").as("status"));
        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));

        List<OrderStatsDto> result = criteria.list();
        Map<YFOrderState, Integer> ordersStats = new HashMap<YFOrderState, Integer>();
        for (OrderStatsDto tmp : result) {
            ordersStats.put(tmp.getStatus(), tmp.getNumber());
View Full Code Here

        criteria.add(Restrictions.ge("date", startDate));
        criteria.add(Restrictions.le("date", endDate));

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.count("id").as("number")).add(Projections.groupProperty("product").as("dish"));
        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));
        criteria.addOrder(Order.desc("number"));

        return criteria.list();
    }
View Full Code Here

        criteria.add(Restrictions.ge("date", startDate));
        criteria.add(Restrictions.le("date", endDate));

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.countDistinct("uuid").as("number")).add(Projections.groupProperty("menu").as("menu"));
        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));
        criteria.addOrder(Order.desc("number"));

        return criteria.list();
    }
View Full Code Here

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.distinct(Projections.property("menu").as("menu")));
        projectionList.add(Projections.groupProperty("uuid"));

        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));
        return criteria.list();
    }
View Full Code Here

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.distinct(Projections.property("menu").as("menu")));
        projectionList.add(Projections.groupProperty("uuid"));
        projectionList.add(Projections.groupProperty("theme").as("theme"));

        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));
        List<OrderStatsDto> result =  criteria.list();
        for (OrderStatsDto tmp : result) {
            System.out.println(tmp.getTheme().getName());
            System.out.println(tmp.getMenu().getPrice());
        }
View Full Code Here

        ProjectionList projectionList = Projections.projectionList();
        projectionList.add(Projections.sum("p.price").as("sum"));
        projectionList.add(Projections.groupProperty("theme").as("theme"));

        criteria.setProjection(projectionList).setResultTransformer(new AliasToBeanResultTransformer(OrderStatsDto.class));

        return criteria.list();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.transform.AliasToBeanResultTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.