Package org.hibernate.classic

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


    data.prepare();

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

    int count = s.createQuery( "delete Animal where mother = :mother" )
        .setEntity( "mother", data.butterfly )
        .executeUpdate();
    assertEquals( 1, count );

    t.commit();
View Full Code Here


  public void testDeleteSyntaxWithCompositeId() {
    Session s = openSession();
    Transaction t = s.beginTransaction();

    s.createQuery( "delete EntityWithCrazyCompositeKey where id.id = 1 and id.otherId = 2" ).executeUpdate();
    s.createQuery( "delete from EntityWithCrazyCompositeKey where id.id = 1 and id.otherId = 2" ).executeUpdate();
    s.createQuery( "delete from EntityWithCrazyCompositeKey e where e.id.id = 1 and e.id.otherId = 2" ).executeUpdate();

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

  public void testDeleteSyntaxWithCompositeId() {
    Session s = openSession();
    Transaction t = s.beginTransaction();

    s.createQuery( "delete EntityWithCrazyCompositeKey where id.id = 1 and id.otherId = 2" ).executeUpdate();
    s.createQuery( "delete from EntityWithCrazyCompositeKey where id.id = 1 and id.otherId = 2" ).executeUpdate();
    s.createQuery( "delete from EntityWithCrazyCompositeKey e where e.id.id = 1 and e.id.otherId = 2" ).executeUpdate();

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

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

    s.createQuery( "delete EntityWithCrazyCompositeKey where id.id = 1 and id.otherId = 2" ).executeUpdate();
    s.createQuery( "delete from EntityWithCrazyCompositeKey where id.id = 1 and id.otherId = 2" ).executeUpdate();
    s.createQuery( "delete from EntityWithCrazyCompositeKey e where e.id.id = 1 and e.id.otherId = 2" ).executeUpdate();

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

    private void cleanup() {
      Session s = openSession();
      Transaction txn = s.beginTransaction();

      // workaround awesome HSQLDB "feature"
      s.createQuery( "delete from Animal where mother is not null or father is not null" ).executeUpdate();
      s.createQuery( "delete from Animal" ).executeUpdate();
      s.createQuery( "delete from Zoo" ).executeUpdate();
      s.createQuery( "delete from Joiner" ).executeUpdate();
      s.createQuery( "delete from Vehicle" ).executeUpdate();
      s.createQuery( "delete from BooleanLiteralEntity" ).executeUpdate();
View Full Code Here

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

      // workaround awesome HSQLDB "feature"
      s.createQuery( "delete from Animal where mother is not null or father is not null" ).executeUpdate();
      s.createQuery( "delete from Animal" ).executeUpdate();
      s.createQuery( "delete from Zoo" ).executeUpdate();
      s.createQuery( "delete from Joiner" ).executeUpdate();
      s.createQuery( "delete from Vehicle" ).executeUpdate();
      s.createQuery( "delete from BooleanLiteralEntity" ).executeUpdate();
View Full Code Here

      Transaction txn = s.beginTransaction();

      // workaround awesome HSQLDB "feature"
      s.createQuery( "delete from Animal where mother is not null or father is not null" ).executeUpdate();
      s.createQuery( "delete from Animal" ).executeUpdate();
      s.createQuery( "delete from Zoo" ).executeUpdate();
      s.createQuery( "delete from Joiner" ).executeUpdate();
      s.createQuery( "delete from Vehicle" ).executeUpdate();
      s.createQuery( "delete from BooleanLiteralEntity" ).executeUpdate();

      txn.commit();
View Full Code Here

      // workaround awesome HSQLDB "feature"
      s.createQuery( "delete from Animal where mother is not null or father is not null" ).executeUpdate();
      s.createQuery( "delete from Animal" ).executeUpdate();
      s.createQuery( "delete from Zoo" ).executeUpdate();
      s.createQuery( "delete from Joiner" ).executeUpdate();
      s.createQuery( "delete from Vehicle" ).executeUpdate();
      s.createQuery( "delete from BooleanLiteralEntity" ).executeUpdate();

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

      // workaround awesome HSQLDB "feature"
      s.createQuery( "delete from Animal where mother is not null or father is not null" ).executeUpdate();
      s.createQuery( "delete from Animal" ).executeUpdate();
      s.createQuery( "delete from Zoo" ).executeUpdate();
      s.createQuery( "delete from Joiner" ).executeUpdate();
      s.createQuery( "delete from Vehicle" ).executeUpdate();
      s.createQuery( "delete from BooleanLiteralEntity" ).executeUpdate();

      txn.commit();
      s.close();
    }
View Full Code Here

      s.createQuery( "delete from Animal where mother is not null or father is not null" ).executeUpdate();
      s.createQuery( "delete from Animal" ).executeUpdate();
      s.createQuery( "delete from Zoo" ).executeUpdate();
      s.createQuery( "delete from Joiner" ).executeUpdate();
      s.createQuery( "delete from Vehicle" ).executeUpdate();
      s.createQuery( "delete from BooleanLiteralEntity" ).executeUpdate();

      txn.commit();
      s.close();
    }
  }
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.