Package org.hibernate

Class QueryException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IllegalNamedQueryOptionsException, IllegalQueryOperationException, InterpretationException, NamedQueryValidationException, ParsingException, QueryParameterException, SemanticException, SyntaxException, UnknownNamedQueryException

public class QueryException extends HibernateException
A problem occurred translating a Hibernate query to SQL due to illegal query syntax, an operation which is not well-typed, an unresolvable reference to an entity or attribute, an unknown named query, or any similar problem. This exception type is not used to represent failures that occur while executing a query or reading the result set of a query.

The two most important subtypes are:

See Also:
  • Constructor Details

    • QueryException

      @Deprecated(since="6.3") public QueryException(String message)
      Deprecated.
      this constructor does not carry information about the query which caused the failure
      Constructs a QueryException using the specified exception message.
      Parameters:
      message - A message explaining the exception condition
    • QueryException

      @Deprecated(since="6.3") public QueryException(String message, Exception cause)
      Deprecated.
      this constructor does not carry information about the query which caused the failure
      Constructs a QueryException using the specified exception message and cause.
      Parameters:
      message - A message explaining the exception condition
      cause - The underlying cause
    • QueryException

      public QueryException(String message, String queryString)
      Constructs a QueryException using the specified exception message and query string.
      Parameters:
      message - A message explaining the exception condition
      queryString - The query being evaluated when the exception occurred
    • QueryException

      public QueryException(String message, String queryString, Exception cause)
      Constructs a QueryException using the specified exception message and query string.
      Parameters:
      message - A message explaining the exception condition
      queryString - The query being evaluated when the exception occurred
      cause - The underlying cause
    • QueryException

      @Deprecated(since="6.3") public QueryException(Exception cause)
      Deprecated.
      this constructor does not carry information about the query which caused the failure
      Constructs a QueryException using the specified cause.
      Parameters:
      cause - The underlying cause
  • Method Details

    • getQueryString

      public String getQueryString()
      Retrieve the query being evaluated when the exception occurred. May be null, but generally should not be.
      Returns:
      The query string
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable
    • getOriginalMessage

      protected final String getOriginalMessage()