Package org.hibernate.transform

Examples of org.hibernate.transform.DistinctRootEntityResultTransformer


  public void testNoScroll() {
    try {
      insertTestData();
      Session s = openSession();
      List list = s.createQuery( QUERY ).setResultTransformer(new DistinctRootEntityResultTransformer() ).list();
      assertResultFromAllUsers( list );
      s.close();
    }
    finally {
      deleteAll();
View Full Code Here


    Session session = openSession();
    session.enableFilter( "effectiveDate" ).setParameter( "asOfDate", new Date() );

    Product prod = ( Product ) session.createCriteria( Product.class )
            .setResultTransformer( new DistinctRootEntityResultTransformer() )
            .add( Restrictions.eq( "id", testData.prod1Id ) )
            .uniqueResult();

    assertNotNull( prod );
    assertEquals( "Incorrect Product.categories count for filter", 1, prod.getCategories().size() );
View Full Code Here

    session.close();

    session = openSession();

    results = session.createQuery( "select a from Animal a, Animal b order by a.id" )
        .setResultTransformer(new DistinctRootEntityResultTransformer())
        .list();
    assertEquals( "Incorrect result size", 2, results.size());
    assertTrue( "Incorrect return type", results.get(0) instanceof Animal );
    firstAnimal = (Animal) results.get(0);
    secondAnimal = (Animal) results.get(1);
View Full Code Here

    session.close();

    session = openSession();

    results = session.createQuery( "select a from Animal a, Animal b order by a.id" )
        .setResultTransformer(new DistinctRootEntityResultTransformer())
        .list();
    assertEquals( "Incorrect result size", 2, results.size());
    assertTrue( "Incorrect return type", results.get(0) instanceof Animal );
    firstAnimal = (Animal) results.get(0);
    secondAnimal = (Animal) results.get(1);
View Full Code Here

    Session session = openSession();
    session.enableFilter( "effectiveDate" ).setParameter( "asOfDate", new Date() );

    Product prod = ( Product ) session.createCriteria( Product.class )
            .setResultTransformer( new DistinctRootEntityResultTransformer() )
            .add( Restrictions.eq( "id", testData.prod1Id ) )
            .uniqueResult();

    assertNotNull( prod );
    assertEquals( "Incorrect Product.categories count for filter", 1, prod.getCategories().size() );
View Full Code Here

  public void testNoScroll() {
    try {
      insertTestData();
      Session s = openSession();
      List list = s.createQuery( QUERY ).setResultTransformer(new DistinctRootEntityResultTransformer() ).list();
      assertResultFromAllUsers( list );
      s.close();
    }
    finally {
      deleteAll();
View Full Code Here

    l = s.createSQLQuery( "select {org.*}, {emp.*} " +
             "from ORGANIZATION org " +
             "     left outer join EMPLOYMENT emp on org.ORGID = emp.EMPLOYER, ORGANIZATION org2" )
    .addEntity("org", Organization.class)
    .addJoin("emp", "org.employments")
    .setResultTransformer(new DistinctRootEntityResultTransformer())
    .list();
    assertEquals( l.size(), 2 );

    t.commit();
    s.close();
View Full Code Here

    session.close();

    session = openSession();

    results = session.createQuery( "select a from Animal a, Animal b order by a.id" )
        .setResultTransformer(new DistinctRootEntityResultTransformer())
        .list();
    assertEquals( "Incorrect result size", 2, results.size());
    assertTrue( "Incorrect return type", results.get(0) instanceof Animal );
    firstAnimal = (Animal) results.get(0);
    secondAnimal = (Animal) results.get(1);
View Full Code Here

    Session session = openSession();
    session.enableFilter( "effectiveDate" ).setParameter( "asOfDate", new Date() );

    Product prod = ( Product ) session.createCriteria( Product.class )
            .setResultTransformer( new DistinctRootEntityResultTransformer() )
            .add( Restrictions.eq( "id", testData.prod1Id ) )
            .uniqueResult();

    assertNotNull( prod );
    assertEquals( "Incorrect Product.categories count for filter", 1, prod.getCategories().size() );
View Full Code Here

    session.close();

    session = openSession();

    results = session.createQuery( "select a from Animal a, Animal b order by a.id" )
        .setResultTransformer(new DistinctRootEntityResultTransformer())
        .list();
    assertEquals( "Incorrect result size", 2, results.size());
    assertTrue( "Incorrect return type", results.get(0) instanceof Animal );
    firstAnimal = (Animal) results.get(0);
    secondAnimal = (Animal) results.get(1);
View Full Code Here

TOP

Related Classes of org.hibernate.transform.DistinctRootEntityResultTransformer

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.