Search in sources :

Example 21 with QueryException

use of com.querydsl.core.QueryException in project querydsl by querydsl.

the class JavaSE7SQLExceptionWrapper method wrap.

@Override
public RuntimeException wrap(String message, SQLException exception) {
    QueryException rv = new QueryException(message, exception);
    SQLException linkedException = exception.getNextException();
    while (linkedException != null) {
        rv.addSuppressed(linkedException);
        linkedException = linkedException.getNextException();
    }
    return rv;
}
Also used : QueryException(com.querydsl.core.QueryException) SQLException(java.sql.SQLException)

Example 22 with QueryException

use of com.querydsl.core.QueryException in project midpoint by Evolveum.

the class AddObjectContext method execute.

/**
 * Inserts the object provided to the constructor and returns its OID.
 */
public String execute() throws SchemaException, ObjectAlreadyExistsException {
    try (JdbcSession jdbcSession = repositoryContext.newJdbcSession().startTransaction()) {
        String oid = execute(jdbcSession);
        jdbcSession.commit();
        return oid;
    } catch (QueryException e) {
        // Querydsl exception, not ours
        Throwable cause = e.getCause();
        if (cause instanceof PSQLException) {
            SqaleUtils.handlePostgresException((PSQLException) cause);
        }
        throw e;
    }
}
Also used : JdbcSession(com.evolveum.midpoint.repo.sqlbase.JdbcSession) QueryException(com.querydsl.core.QueryException) PSQLException(org.postgresql.util.PSQLException)

Aggregations

QueryException (com.querydsl.core.QueryException)22 IOException (java.io.IOException)11 ScoreDoc (org.apache.lucene.search.ScoreDoc)6 SQLException (java.sql.SQLException)5 EmptyCloseableIterator (com.mysema.commons.lang.EmptyCloseableIterator)3 DefaultQueryMetadata (com.querydsl.core.DefaultQueryMetadata)3 NonUniqueResultException (com.querydsl.core.NonUniqueResultException)3 QueryMetadata (com.querydsl.core.QueryMetadata)3 QueryModifiers (com.querydsl.core.QueryModifiers)3 OrderSpecifier (com.querydsl.core.types.OrderSpecifier)3 Field (java.lang.reflect.Field)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Document (org.apache.lucene.document.Document)3 Sort (org.apache.lucene.search.Sort)3 TotalHitCountCollector (org.apache.lucene.search.TotalHitCountCollector)3 Nullable (org.jetbrains.annotations.Nullable)3 Path (com.querydsl.core.types.Path)2 RelationalPath (com.querydsl.sql.RelationalPath)2 Statement (java.sql.Statement)2