Package org.hibernate

Examples of org.hibernate.Transaction.commit()


      channel.setLocation(new URL("http://nava.de/test/channelFoo"));
      session.saveOrUpdate(channel);
      grp1 = builder.createChannelGroup("group A");
      grp1.add(channel);
      session.saveOrUpdate(grp1);
      tx.commit();
      chId = (int) channel.getId();
      chGrpId = (int) grp1.getId();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
View Full Code Here


    // --- delete test objects
    try {
      tx = session.beginTransaction();
      session.delete(grp1);
      session.delete(channel);
      tx.commit();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
      throw he;
View Full Code Here

      // Query q = session.createQuery("select ch.id from Channel as ch");
      // List result = q.list();
      List result = session.createQuery("from Channel").list();
      // List chs = session.find("from Channel as ch where cat.title = ?",
      //                         "Another category title", Hibernate.STRING);
      tx.commit();
      Iterator it = result.iterator();
      while (it.hasNext()) {
        Channel c = (Channel) it.next();
        System.out.println("retrieved channel --> " + c.getId());
        System.out.println("  c: " + c);
View Full Code Here

      // create cat2
      cat2 = builder.createCategory(cat1, "Agent_A");
      session.saveOrUpdate(cat2);
      channel.addCategory(cat2);
      session.saveOrUpdate(channel);
      tx.commit();
      chId = (int) channel.getId();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
View Full Code Here

    try {
      tx = session.beginTransaction();
      session.delete(cat1);
      session.delete(cat2);
      session.delete(channel);
      tx.commit();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
      throw he;
View Full Code Here

      session.saveOrUpdate(item1);
      ItemIF item2 = builder.createItem(channel, "Item 2 for " + chanName,
                                        "Second in line", new URL("http://www.sf1.net"));
      session.saveOrUpdate(item2);
      session.saveOrUpdate(channel);
      tx.commit();
      chId = (int) channel.getId();
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
View Full Code Here

    try {
      tx = session.beginTransaction();
      File inpFile = new File(getDataDir(), "xmlhack-0.91.xml");
      ChannelIF channel = FeedParser.parse(builder, inpFile);
      session.save(channel);
      tx.commit();
      assertEquals(6, channel.getItems().size());
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
      if (tx != null) tx.rollback();
View Full Code Here

      ItemIF itA = builder.createItem(chA, "Simple item", "oh what a desc",
                                      new URL("http://www.sf.net/"));
      logger.info("created itA: " + itA);
      session.save(chA);
      logger.info("saved chA");
      tx.commit();
      logger.info("transaction commited");
      assertEquals(chA_id, chA.getId());
    }
    catch (HibernateException he) {
      logger.warn("trying to rollback the transaction");
View Full Code Here

      HibernateUtil.lock(first, session);
      HibernateUtil.lock(second, session);
      mergeGroups(first, second, session);

      tx.commit();

      second.setId(-1);
    } catch (Exception e) {
      if (tx != null) {
        try {
View Full Code Here

      HibernateUtil.lock(channel, session);
      group.add(channel);
      HibernateUtil.updateObject(group, session);

      tx.commit();
    } catch (Exception e) {
      if (tx != null) {
        try {
          tx.rollback();
        } catch (HibernateException e1) {
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.