Package org.hibernate

Class QueryException

    • Constructor Summary

      Constructors 
      Constructor Description
      QueryException​(java.lang.Exception cause)
      Constructs a QueryException using the specified cause.
      QueryException​(java.lang.String message)
      Constructs a QueryException using the specified exception message.
      QueryException​(java.lang.String message, java.lang.Exception cause)
      Constructs a QueryException using the specified exception message and cause.
      QueryException​(java.lang.String message, java.lang.String queryString)
      Constructs a QueryException using the specified exception message and query-string.
      QueryException​(java.lang.String message, java.lang.String queryString, java.lang.Exception cause)
      Constructs a QueryException using the specified exception message and query-string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected QueryException generateQueryException​(java.lang.String queryString)
      Called from wrapWithQueryString(String) when we really need to generate a new QueryException (or subclass).
      java.lang.String getMessage()  
      protected java.lang.String getOriginalMessage()  
      java.lang.String getQueryString()
      Retrieve the query being evaluated when the exception occurred.
      QueryException wrapWithQueryString​(java.lang.String queryString)
      Wraps this exception with another, of same kind, with the specified queryString.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • QueryException

        public QueryException​(java.lang.String message)
        Constructs a QueryException using the specified exception message.
        Parameters:
        message - A message explaining the exception condition
      • QueryException

        public QueryException​(java.lang.String message,
                              java.lang.Exception cause)
        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​(java.lang.String message,
                              java.lang.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​(java.lang.String message,
                              java.lang.String queryString,
                              java.lang.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

        public QueryException​(java.lang.Exception cause)
        Constructs a QueryException using the specified cause.
        Parameters:
        cause - The underlying cause
    • Method Detail

      • getQueryString

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

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

        protected final java.lang.String getOriginalMessage()
      • wrapWithQueryString

        public final QueryException wrapWithQueryString​(java.lang.String queryString)
        Wraps this exception with another, of same kind, with the specified queryString. If this exception already has a queryString defined, the same exception (this) is returned. Otherwise the protected generateQueryException(String) is called, to allow subclasses to properly create the correct subclass for return.
        Parameters:
        queryString - The query string that led to the QueryException
        Returns:
        this, if this has null for getQueryString(); otherwise a new QueryException (or subclass) is returned.