Package org.jugile.util

Examples of org.jugile.util.DBConnection.commit()


        o.version = (Integer)row.get(3);
        o._setFlds(dd,bi(),row,countSelectHeaderFlds());
        // copy fields to copy
        o.copy(bi(),this);
      }
      c.commit();
    } catch (Exception e) {
      try { c.rollback(); fail(e); } catch (Exception e2) { fail(e2); }
    } finally {
      try { c.free(); } catch (Exception e2) { fail(e2); }
    }
View Full Code Here


  public void flush() {
    DBPool db = DBPool.getPool();
    DBConnection c = db.getConnection();   
    try {
      this._dbWriteFlds(c, bi());
      c.commit();
      modified = false; // not modified anymore
      // _modified Time still remains
      incrVersion();
    } catch (Exception e) {
      try { c.rollback(); fail(e); } catch (Exception e2) { fail(e2); }
View Full Code Here

    String sql = "update " + table() + " set archived="+a+" where id_f="+getId();
    DBPool db = DBPool.getPool();
    DBConnection c = db.getConnection();
    try {
      c.update(sql);
      c.commit();
    } catch (Exception e) {
      log.error("dbread failed",e);
      try { c.rollback(); } catch (Exception e2) { fail(e2);}
    } finally {
      try { c.free(); } catch (Exception e) {}
View Full Code Here

      nid = (Integer)res.get(0).get(0);
      c.prepare("update idpool set nextid=? where obj=?");
      c.param(nid+idIncrement);
      c.param(obj);
      c.execute();
      c.commit();
    } catch (Exception e) {
      try { c.rollback(); } catch (Exception e2) { } fail(e);
    } finally {
      try { c.free(); } catch (Exception e) { log.fatal("could not free connection",e); }     
    }
View Full Code Here

    try {
      DBPool db = DBPool.getPool();
      DBConnection c = db.getConnection();
      try {
        int res = cd().saveToDB(c); // whole core domain cd()
        c.commit();
        return res;
      } catch (Exception e) {
        try { c.rollback(); fail(e); } catch (Exception e2) { fail(e2); }
      } finally {
        try { c.free(); } catch (Exception e2) { fail(e2); }
View Full Code Here

    DBPool db = DBPool.getPool();
    DBConnection c = db.getConnection();
    try {
      int res = uow().writeToDB(c, classes());
      DBQueue.writeMessage(delta, node(), nodes(), c);
      c.commit();
      return res;
    } catch (Exception e) {
      try { c.rollback(); } catch (Exception e2) { fail(e2); }
      log.error("could not write db changes",e);
      fail(e);
View Full Code Here

    if (nodes == null) return;
    DBPool pool = DBPool.getPool();
    DBConnection c = pool.getConnection();
    try {
      writeMessage(msg,node,nodes,c);
      c.commit();
    } catch (java.sql.SQLNonTransientConnectionException se) {
      log.info("connection error in write. retrying in 30 sec: " + node);
      // sleep 30 sec and retry
      try {
        Thread.sleep(30000);
View Full Code Here

      c.param(node);
      c.param(NEW);
      for (Long id : ids) { c.param(id); }
      int count = c.execute();
      if (count != ids.size()) fail("inconsistent status write: " + count + "/"+ ids.size());
      c.commit();
      log.debug("read messages from :" + node + " size: " + count);
      return msgs;
    } catch (java.sql.SQLNonTransientConnectionException se) {
      log.info("connection error in read. retrying in 30 sec: " + node);
      // sleep 30 sec and retry
View Full Code Here

    try {
      String sql = "delete from dbmq_queue_t where nodeid=?";
      c.prepare(sql);
      c.param(name);
      int res = c.execute();
      c.commit();
      return res;
    } catch (java.sql.SQLNonTransientConnectionException se) {
      fail("connection error in flush: " + name);
    } catch (Exception e) {
      try { c.rollback()} catch (Exception e2) { fail(e2);}
View Full Code Here

    try {
      String sql = "delete from dbmq_queue_t where nodeid=? and status!=0";
      c.prepare(sql);
      c.param(name);
      int res = c.execute();
      c.commit();
      return res;
    } catch (java.sql.SQLNonTransientConnectionException se) {
      fail("connection error in flush: " + name);
    } catch (Exception e) {
      try { c.rollback()} catch (Exception e2) { fail(e2);}
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.