Examples of DbRuntimeException


Examples of com.xiaoleilu.hutool.exceptions.DbRuntimeException

    String driver = null;
    try {
      conn = ds.getConnection();
      driver = identifyDriver(conn);
    } catch (Exception e) {
      throw new DbRuntimeException("Identify driver error!", e);
    }finally {
      close(conn);
    }
   
    return driver;
View Full Code Here

Examples of com.xiaoleilu.hutool.exceptions.DbRuntimeException

      driver =  identifyDriver(meta.getDatabaseProductName());
      if(StrUtil.isBlank(driver)) {
        driver =  identifyDriver(meta.getDriverName());
      }
    } catch (SQLException e) {
      throw new DbRuntimeException("Identify driver error!", e);
    }
   
    return driver;
  }
View Full Code Here

Examples of com.xiaoleilu.hutool.exceptions.DbRuntimeException

   */
  public Session(DataSource ds) {
    try {
      this.conn = ds.getConnection();
    } catch (SQLException e) {
      throw new DbRuntimeException("Get connection error!", e);
    }
    this.runner = new SqlConnRunner(DialectFactory.newDialect(conn));
  }
View Full Code Here

Examples of com.xiaoleilu.hutool.exceptions.DbRuntimeException

    this.pass = pass;
    this.driver = DbUtil.identifyDriver(url);
    try {
      Class.forName(this.driver);
    } catch (ClassNotFoundException e) {
      throw new DbRuntimeException(e, "Get jdbc driver from [{}] error!", url);
    }
  }
View Full Code Here

Examples of org.olat.core.logging.DBRuntimeException

   * @param o Object to be updated
   */ 
  void updateObject(DBTransaction trx, Object o) {
   
    if (trx.isRolledBack() || trx.isCommitted()) { // some program bug
      throw new DBRuntimeException("cannot update in a transaction that is rolledback or committed " + o);
    }
    try {
      getSession().update(o);
      if (Tracing.isDebugEnabled(DBManager.class)) {
        Tracing.logDebug("update (trans "+trx.hashCode()+") class "+o.getClass().getName()+" = "+o.toString(),DBManager.class)
      }                 
    } catch (HibernateException e) { // we have some error
      trx.setErrorAndRollback(e);
      setError(e);
      throw new DBRuntimeException("Update object failed in transaction. Query: " +  o , e);
    }
  }
View Full Code Here

Examples of org.olat.core.logging.DBRuntimeException

   * @param o Object to be deleted
   */ 
  void deleteObject(DBTransaction trx, Object o) {
   
    if (trx.isRolledBack() || trx.isCommitted()) { // some program bug
      throw new DBRuntimeException("cannot delete in a transaction that is rolledback or committed " + o);
    }
    try {
      getSession().delete(o);
      if (Tracing.isDebugEnabled(DBManager.class)) {
        Tracing.logDebug("delete (trans "+trx.hashCode()+") class "+o.getClass().getName()+" = "+o.toString(),DBManager.class)
      }
    } catch (HibernateException e) { // we have some error
      trx.setErrorAndRollback(e);
      setError(e);
      throw new DBRuntimeException("Delete of object failed: " + o, e);
    }
  }
View Full Code Here

Examples of org.olat.core.logging.DBRuntimeException

   * @param o Object to be saved
   */ 
  void saveObject(DBTransaction trx, Object o) {
    Session hibernateSession = this.getSession();
    if (trx.isRolledBack() || trx.isCommitted()) { // some program bug
      throw new DBRuntimeException("cannot save in a transaction that is rolledback or committed: " + o);
    }
    try {
      hibernateSession.save(o);
      if (Tracing.isDebugEnabled(DBManager.class)) {
        Tracing.logDebug("save (trans "+trx.hashCode()+") class "+o.getClass().getName()+" = "+o.toString(),DBManager.class)
      }           

    } catch (HibernateException e) { // we have some error
      trx.setErrorAndRollback(e);   
      throw new DBRuntimeException("Save failed in transaction. object: " +  o, e);
    }

  }
View Full Code Here

Examples of org.olat.core.logging.DBRuntimeException

      }

    } catch (HibernateException e) {
      trx.setErrorAndRollback(e);
      String msg = "loadObject error: " + theClass + " " + pK + " ";
      throw new DBRuntimeException(msg, e);
    }
    return o;
  }
View Full Code Here

Examples of org.olat.core.logging.DBRuntimeException

      }
    } catch (HibernateException e) {
      trx.setErrorAndRollback(e);
      String msg = "Find failed in transaction. Query: " +  query + " " + e;
      setError(e);
      throw new DBRuntimeException(msg, e);
    }
    return li;
  }
View Full Code Here

Examples of org.olat.core.logging.DBRuntimeException

 
    } catch (HibernateException e) {
      trx.setErrorAndRollback(e);
      String msg = "Find failed in transaction. Query: " +  query + " " + e;
      setError(e);
      throw new DBRuntimeException(msg, e);
    }
    return li;
  }
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.