Package org.hibernate.classic

Examples of org.hibernate.classic.Session.createQuery()


    // These should reach out into *all* subclass tables...
    Session s = openSession();
    Transaction t = s.beginTransaction();

    int count = s.createQuery( "update Vehicle set owner = 'Steve'" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );
    count = s.createQuery( "update Vehicle set owner = null where owner = 'Steve'" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );

    count = s.createQuery( "delete Vehicle where owner is null" ).executeUpdate();
View Full Code Here


    Session s = openSession();
    Transaction t = s.beginTransaction();

    int count = s.createQuery( "update Vehicle set owner = 'Steve'" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );
    count = s.createQuery( "update Vehicle set owner = null where owner = 'Steve'" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );

    count = s.createQuery( "delete Vehicle where owner is null" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );
View Full Code Here

    int count = s.createQuery( "update Vehicle set owner = 'Steve'" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );
    count = s.createQuery( "update Vehicle set owner = null where owner = 'Steve'" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );

    count = s.createQuery( "delete Vehicle where owner is null" ).executeUpdate();
    assertEquals( "incorrect restricted update count", 4, count );

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

    data.prepare();

    Session s = openSession();
    Transaction t = s.beginTransaction();

    int count = s.createQuery( "update PettingZoo set address.city = null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );
    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );

    count = s.createQuery( "update Zoo set address.city = null" ).executeUpdate();
View Full Code Here

    Session s = openSession();
    Transaction t = s.beginTransaction();

    int count = s.createQuery( "update PettingZoo set address.city = null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );
    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );

    count = s.createQuery( "update Zoo set address.city = null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );
    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
View Full Code Here

    int count = s.createQuery( "update PettingZoo set address.city = null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );
    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );

    count = s.createQuery( "update Zoo set address.city = null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );
    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );

    t.commit();
View Full Code Here

    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );

    count = s.createQuery( "update Zoo set address.city = null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );
    count = s.createQuery( "delete Zoo where address.city is null" ).executeUpdate();
    assertEquals( "Incorrect discrim subclass delete count", 1, count );

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

    data.prepare();

    Session s = openSession();
    Transaction t = s.beginTransaction();

    int count = s.createQuery( "update Mammal set bodyWeight = null" ).executeUpdate();
    assertEquals( "Incorrect deletion count on joined subclass", 2, count );

    count = s.createQuery( "delete Animal where bodyWeight = null" ).executeUpdate();
    assertEquals( "Incorrect deletion count on joined subclass", 2, count );
View Full Code Here

    Transaction t = s.beginTransaction();

    int count = s.createQuery( "update Mammal set bodyWeight = null" ).executeUpdate();
    assertEquals( "Incorrect deletion count on joined subclass", 2, count );

    count = s.createQuery( "delete Animal where bodyWeight = null" ).executeUpdate();
    assertEquals( "Incorrect deletion count on joined subclass", 2, count );

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

    s.close();

    // now try the bulk delete
    s = openSession();
    s.beginTransaction();
    int count = s.createQuery( "delete SimpleEntityWithAssociation e where size( e.associatedEntities ) = 0 and e.name like '%'" ).executeUpdate();
    assertEquals( "incorrect delete count", 1, count );
    s.getTransaction().commit();
    s.close();

    // finally, clean up
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.