public class QueryException extends HibernateException
A problem occurred translating a Hibernate query to SQL due to invalid query syntax, etc.
Constructor and Description |
---|
QueryException(Exception cause)
Constructs a QueryException using the specified cause.
|
QueryException(String message)
Constructs a QueryException using the specified exception message.
|
QueryException(String message,
Exception cause)
Constructs a QueryException using the specified exception message and cause.
|
QueryException(String message,
String queryString)
Constructs a QueryException using the specified exception message and query-string.
|
QueryException(String message,
String queryString,
Exception cause)
Constructs a QueryException using the specified exception message and query-string.
|
Modifier and Type | Method and Description |
---|---|
protected QueryException |
generateQueryException(String queryString)
Called from
wrapWithQueryString(String) when we really need to generate a new QueryException
(or subclass). |
String |
getMessage() |
protected String |
getOriginalMessage() |
String |
getQueryString()
Retrieve the query being evaluated when the exception occurred.
|
QueryException |
wrapWithQueryString(String queryString)
Wraps this exception with another, of same kind, with the specified queryString.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public QueryException(String message)
Constructs a QueryException using the specified exception message.
message
- A message explaining the exception conditionpublic QueryException(String message, Exception cause)
Constructs a QueryException using the specified exception message and cause.
message
- A message explaining the exception conditioncause
- The underlying causepublic QueryException(String message, String queryString)
Constructs a QueryException using the specified exception message and query-string.
message
- A message explaining the exception conditionqueryString
- The query being evaluated when the exception occurredpublic QueryException(String message, String queryString, Exception cause)
Constructs a QueryException using the specified exception message and query-string.
message
- A message explaining the exception conditionqueryString
- The query being evaluated when the exception occurredcause
- The underlying causepublic QueryException(Exception cause)
Constructs a QueryException using the specified cause.
cause
- The underlying causepublic String getQueryString()
Retrieve the query being evaluated when the exception occurred. May be null, but generally should not.
public String getMessage()
getMessage
in class Throwable
protected final String getOriginalMessage()
public final QueryException wrapWithQueryString(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.
queryString
- The query string that led to the QueryExceptionthis
, if this
has null
for getQueryString()
; otherwise a new
QueryException (or subclass) is returned.protected QueryException generateQueryException(String queryString)
Called from wrapWithQueryString(String)
when we really need to generate a new QueryException
(or subclass).
<p/>
NOTE : implementors should take care to use getOriginalMessage()
for the message, not
getMessage()
queryString
- The query stringgetOriginalMessage()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.