Top Description Fields Constructors Methods
org.hibernate

public Class QueryException

extends HibernateException
Class Inheritance
Known Direct Subclasses
org.hibernate.QueryParameterException, org.hibernate.hql.internal.QueryExecutionRequestException, org.hibernate.hql.internal.ast.QuerySyntaxException

A problem occurred translating a Hibernate query to SQL due to invalid query syntax, etc.

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
public
QueryException(String
A message explaining the exception condition
message
)

Constructs a QueryException using the specified exception message.

public
QueryException(String
A message explaining the exception condition
message
,
Exception
The underlying cause
cause
)

Constructs a QueryException using the specified exception message and cause.

public
QueryException(String
A message explaining the exception condition
message
,
String
The query being evaluated when the exception occurred
queryString
)

Constructs a QueryException using the specified exception message and query-string.

public
QueryException(String
A message explaining the exception condition
message
,
String
The query being evaluated when the exception occurred
queryString
,
Exception
The underlying cause
cause
)

Constructs a QueryException using the specified exception message and query-string.

public
QueryException(Exception
The underlying cause
cause
)

Constructs a QueryException using the specified cause.

Method Summary

Modifier and TypeMethod and Description
protected QueryException

Returns:

The generated QueryException (or subclass)
generateQueryException
(String
The query string
queryString
)

Called from wrapWithQueryString(String) when we really need to generate a new QueryException (or subclass).

public String
getMessage()

Overrides java.lang.Throwable.getMessage.

Returns the detail message string of this throwable.
protected final String
public String

Returns:

The query string
getQueryString
()

Retrieve the query being evaluated when the exception occurred.

public final QueryException

Returns:

this, if this has null for getQueryString(); otherwise a new QueryException (or subclass) is returned.
wrapWithQueryString
(String
The query string that led to the QueryException
queryString
)

Wraps this exception with another, of same kind, with the specified queryString.

Field Detail

queryStringback to summary
private final String queryString

Constructor Detail

QueryExceptionback to summary
public QueryException(String message)

Constructs a QueryException using the specified exception message.

Parameters
message:String

A message explaining the exception condition

QueryExceptionback to summary
public QueryException(String message, Exception cause)

Constructs a QueryException using the specified exception message and cause.

Parameters
message:String

A message explaining the exception condition

cause:Exception

The underlying cause

QueryExceptionback to summary
public QueryException(String message, String queryString)

Constructs a QueryException using the specified exception message and query-string.

Parameters
message:String

A message explaining the exception condition

queryString:String

The query being evaluated when the exception occurred

QueryExceptionback to summary
public QueryException(String message, String queryString, Exception cause)

Constructs a QueryException using the specified exception message and query-string.

Parameters
message:String

A message explaining the exception condition

queryString:String

The query being evaluated when the exception occurred

cause:Exception

The underlying cause

QueryExceptionback to summary
public QueryException(Exception cause)

Constructs a QueryException using the specified cause.

Parameters
cause:Exception

The underlying cause

Method Detail

generateQueryExceptionback to summary
protected QueryException generateQueryException(String queryString)

Called from wrapWithQueryString(String) when we really need to generate a new QueryException (or subclass).

NOTE : implementors should take care to use getOriginalMessage() for the message, not getMessage()

Parameters
queryString:String

The query string

Returns:QueryException

The generated QueryException (or subclass)

See Also
getOriginalMessage()
getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Doc from java.lang.Throwable.getMessage.

Returns the detail message string of this throwable.

Returns:String

the detail message string of this Throwable instance (which may be null).

Annotations
@Override
getOriginalMessageback to summary
protected final String getOriginalMessage()
getQueryStringback to summary
public String getQueryString()

Retrieve the query being evaluated when the exception occurred. May be null, but generally should not.

Returns:String

The query string

wrapWithQueryStringback to summary
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.

Parameters
queryString:String

The query string that led to the QueryException

Returns:QueryException

this, if this has null for getQueryString(); otherwise a new QueryException (or subclass) is returned.