use of org.olat.core.logging.DBRuntimeException in project openolat by klemens.
the class DBImpl method createQuery.
/**
* Create a DBQuery
*
* @param query
* @return DBQuery
*/
@Override
public DBQuery createQuery(String query) {
try {
EntityManager em = getCurrentEntityManager();
Query q = getSession(em).createQuery(query);
return new DBQueryImpl(q);
} catch (HibernateException he) {
getData().setError(he);
throw new DBRuntimeException("Error while creating DBQueryImpl: ", he);
}
}
use of org.olat.core.logging.DBRuntimeException in project openolat by klemens.
the class DBImpl method updateObject.
/**
* Update an object.
*
* @param object
*/
@Override
public void updateObject(Object object) {
EntityManager em = getCurrentEntityManager();
EntityTransaction trx = em.getTransaction();
if (unusableTrx(trx)) {
// some program bug
throw new DBRuntimeException("cannot update in a transaction that is rolledback or committed " + object);
}
try {
getSession(em).update(object);
} catch (HibernateException e) {
// we have some error
trx.setRollbackOnly();
getData().setError(e);
throw new DBRuntimeException("Update object failed in transaction. Query: " + object, e);
}
}
use of org.olat.core.logging.DBRuntimeException in project openolat by klemens.
the class DBImpl method deleteObject.
/**
* Delete an object.
*
* @param object
*/
@Override
public void deleteObject(Object object) {
EntityManager em = getCurrentEntityManager();
EntityTransaction trx = em.getTransaction();
if (unusableTrx(trx)) {
// some program bug
throw new DBRuntimeException("cannot delete in a transaction that is rolledback or committed " + object);
}
try {
Object relaoded = em.merge(object);
em.remove(relaoded);
if (log.isDebug()) {
log.debug("delete (trans " + trx.hashCode() + ") class " + object.getClass().getName() + " = " + object.toString());
}
} catch (HibernateException e) {
// we have some error
trx.setRollbackOnly();
getData().setError(e);
throw new DBRuntimeException("Delete of object failed: " + object, e);
}
}
use of org.olat.core.logging.DBRuntimeException in project openolat by klemens.
the class IQTESTCourseNode method updateUserScoreEvaluation.
/**
* @see org.olat.course.nodes.AssessableCourseNode#updateUserScoreEvaluation(org.olat.course.run.scoring.ScoreEvaluation,
* org.olat.course.run.userview.UserCourseEnvironment,
* org.olat.core.id.Identity)
*/
@Override
public void updateUserScoreEvaluation(ScoreEvaluation scoreEvaluation, UserCourseEnvironment userCourseEnvironment, Identity coachingIdentity, boolean incrementAttempts, Role by) {
AssessmentManager am = userCourseEnvironment.getCourseEnvironment().getAssessmentManager();
Identity mySelf = userCourseEnvironment.getIdentityEnvironment().getIdentity();
try {
am.saveScoreEvaluation(this, coachingIdentity, mySelf, scoreEvaluation, userCourseEnvironment, incrementAttempts, by);
} catch (DBRuntimeException ex) {
throw new KnownIssueException("DBRuntimeException - Row was updated or deleted...", 3570, ex);
}
}
Aggregations