Package org.hibernate.classic

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


      transaction = session.beginTransaction();
      // TODO: this is not the most efficient loop (opening/closing file)
      for (Iterator iter = queryStrings.iterator(); iter.hasNext();) {
        String query = (String) iter.next();
       
        List list = session.createQuery(query).list();
       
        if(getFileName()!=null) {
          PrintWriter pw = null;
          try {
            File file = new File( getOutputDirectory(), getFileName() );
View Full Code Here


      SimpleJtaTransactionManagerImpl.getInstance().begin();
      try {
         
          Session session = getSessions().getCurrentSession();
          int rowsAffected = session.createQuery(deleteHQL)
                                .setFlushMode(FlushMode.AUTO)
                                .setParameter("cName", "Red Hat")
                                .executeUpdate();
          SimpleJtaTransactionManagerImpl.getInstance().commit();
          return rowsAffected;
View Full Code Here

      SimpleJtaTransactionManagerImpl.getInstance().begin();
      try {
         
          Session session = getSessions().getCurrentSession();
          List results = session.createQuery(selectHQL)
                            .setFlushMode(FlushMode.AUTO)
                            .setParameter("cName", customerName)
                            .list();
          SimpleJtaTransactionManagerImpl.getInstance().commit();
          return results; 
View Full Code Here

      SimpleJtaTransactionManagerImpl.getInstance().begin();
      try {
         
          Session session = getSessions().getCurrentSession();
          List results = session.createQuery(selectHQL)
                            .setFlushMode(FlushMode.AUTO)
                            .setParameter("cTLF", tlf)
                            .list();
          SimpleJtaTransactionManagerImpl.getInstance().commit();
          return results;      
View Full Code Here

      SimpleJtaTransactionManagerImpl.getInstance().begin();
      try {
         
          Session session = getSessions().getCurrentSession();
          int rowsAffected = session.createQuery(updateHQL)
                                .setFlushMode(FlushMode.AUTO)
                                .setParameter("cNewTLF", newTLF)
                                .setParameter("cName", name)
                                .executeUpdate();
          SimpleJtaTransactionManagerImpl.getInstance().commit();
View Full Code Here

      try {
         
          Session session = getSessions().getCurrentSession();
         
          @SuppressWarnings("unchecked")
          List<Contact> list = session.createQuery(queryHQL).setParameter("cName", name).list();
          list.get(0).setTlf(newTLF);
         
          int rowsAffected = session.createQuery(updateHQL)
                                .setFlushMode(FlushMode.AUTO)
                                .setParameter("cNewTLF", newTLF)
View Full Code Here

         
          @SuppressWarnings("unchecked")
          List<Contact> list = session.createQuery(queryHQL).setParameter("cName", name).list();
          list.get(0).setTlf(newTLF);
         
          int rowsAffected = session.createQuery(updateHQL)
                                .setFlushMode(FlushMode.AUTO)
                                .setParameter("cNewTLF", newTLF)
                                .setParameter("cName", name)
                                .executeUpdate();
          SimpleJtaTransactionManagerImpl.getInstance().commit();
View Full Code Here

      SimpleJtaTransactionManagerImpl.getInstance().begin();
      try {
         
          Session session = getSessions().getCurrentSession();
          session.createQuery(deleteContactHQL)
                 .setFlushMode(FlushMode.AUTO)
                 .executeUpdate();
          session.createQuery(deleteCustomerHQL)
                 .setFlushMode(FlushMode.AUTO)
                 .executeUpdate();
View Full Code Here

         
          Session session = getSessions().getCurrentSession();
          session.createQuery(deleteContactHQL)
                 .setFlushMode(FlushMode.AUTO)
                 .executeUpdate();
          session.createQuery(deleteCustomerHQL)
                 .setFlushMode(FlushMode.AUTO)
                 .executeUpdate();
          SimpleJtaTransactionManagerImpl.getInstance().commit();
      }
      catch (Exception e) {
View Full Code Here

    s.flush();

    // now issue a bulk delete against Car which should force the temp table to be
    // created.  we need to test to ensure that this does not cause the transaction
    // to be committed...
    s.createQuery( "delete from Vehicle" ).executeUpdate();

    s.getTransaction().rollback();
    s.close();

    s = openSession();
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.