Package org.olat.core.logging

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


   * @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

   * @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

      }

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

      }
    } 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

 
    } 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

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

    try {
      q = this.getSession().createQuery(query);
      dbq = new DBQueryImpl(q);
    } catch (HibernateException he) {
      setError(he);
      throw new DBRuntimeException("Error while creating DBQueryImpl: ", he);
    }
    return dbq;
  }
View Full Code Here

  void evict(Object object) {
    try {
      getSession().evict(object);     
    } catch (Exception e) {
      setError(e);
      throw new DBRuntimeException("Error in evict() Object from Database. ", e);
    }
  }
View Full Code Here

  void refresh(Object object) {
    try{
      getSession().refresh(object);
    } catch(Exception e) {
      setError(e);
      throw new DBRuntimeException("Error in refresh() Object from Database. ", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.olat.core.logging.DBRuntimeException

Copyright © 2018 www.massapicom. 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.