/** * Get current Hibernate session. * * @return session */ public Session getSession() { try { Session session = sessionFactory.getCurrentSession(); Preconditions.checkNotNull(session); Preconditions.checkArgument(session.isConnected()); return session; } catch (HibernateException e) { throw new TransactionException(e); } }
public TransactionException(Throwable e) { super(HttpStatus.SC_LOCKED, formatExceptionCause(e), e, null); } }
/** * Get current Hibernate session. * * @return session */ @Override public Session getSession() { try { Session session = sessionFactory.getCurrentSession(); Preconditions.checkNotNull(session); Preconditions.checkArgument(session.isConnected()); return session; } catch (PersistenceException e) { throw new TransactionException(e); } }
public TransactionException(Throwable e) { super(HttpStatus.SC_LOCKED, formatExceptionCause(e), e, null); } }
/** * Get current Hibernate session. * * @return session */ @Override public Session getSession() { try { Session session = sessionFactory.getCurrentSession(); Preconditions.checkNotNull(session); Preconditions.checkArgument(session.isConnected()); return session; } catch (PersistenceException e) { throw new TransactionException(e); } }
@Override public void flush(RequestScope requestScope) { try { deferredTasks.forEach(Runnable::run); deferredTasks.clear(); FlushMode flushMode = session.getHibernateFlushMode(); if (flushMode != FlushMode.COMMIT && flushMode != FlushMode.MANUAL) { session.flush(); } } catch (PersistenceException e) { log.error("Caught hibernate exception during flush", e); throw new TransactionException(e); } }
@Override public void flush(RequestScope requestScope) { try { deferredTasks.forEach(Runnable::run); deferredTasks.clear(); FlushMode flushMode = session.getFlushMode(); if (flushMode != FlushMode.COMMIT && flushMode != FlushMode.MANUAL && flushMode != FlushMode.NEVER) { session.flush(); } } catch (HibernateException e) { log.error("Caught hibernate exception during flush", e); throw new TransactionException(e); } }
@Override public void flush(RequestScope requestScope) { try { deferredTasks.forEach(Runnable::run); deferredTasks.clear(); FlushMode flushMode = session.getHibernateFlushMode(); if (flushMode != FlushMode.COMMIT && flushMode != FlushMode.MANUAL) { session.flush(); } } catch (PersistenceException e) { log.error("Caught hibernate exception during flush", e); throw new TransactionException(e); } }
@Override public void commit(RequestScope scope) { try { this.flush(scope); this.session.getTransaction().commit(); } catch (PersistenceException e) { throw new TransactionException(e); } }
@Override public void commit(RequestScope scope) { try { this.flush(scope); this.session.getTransaction().commit(); } catch (HibernateException e) { throw new TransactionException(e); } }
@Override public void commit(RequestScope scope) { try { this.flush(scope); this.session.getTransaction().commit(); } catch (PersistenceException e) { throw new TransactionException(e); } }
@Override public void commit(RequestScope scope) { // flush all before commits flush(scope); ArrayList<DataStore> commitList = new ArrayList<>(); for (Entry<DataStore, DataStoreTransaction> entry : transactions.entrySet()) { try { entry.getValue().commit(scope); commitList.add(entry.getKey()); } catch (HttpStatusException | WebApplicationException e) { reverseTransactions(commitList, e, scope); throw e; } catch (Error | RuntimeException e) { TransactionException transactionException = new TransactionException(e); reverseTransactions(commitList, transactionException, scope); throw transactionException; } } }
} catch (IOException e) { log.error("Uncaught IO Exception by Elide in GraphQL", e); return buildErrorResponse(new TransactionException(e), isVerbose); } catch (HttpStatusException e) { log.debug("Caught HTTP status exception {}", e.getStatus(), e);
} catch (IOException e) { log.error("Uncaught IO Exception by Elide in GraphQL", e); return buildErrorResponse(new TransactionException(e), isVerbose); } catch (HttpStatusException e) { log.debug("Caught HTTP status exception {}", e.getStatus(), e);
return buildErrorResponse(new TransactionException(e), isVerbose);
return buildErrorResponse(new TransactionException(e), isVerbose);