程序包 org.hibernate
类 QueryException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- javax.persistence.PersistenceException
-
- org.hibernate.HibernateException
-
- org.hibernate.QueryException
-
- 所有已实现的接口:
Serializable
public class QueryException extends HibernateException
A problem occurred translating a Hibernate query to SQL due to invalid query syntax, etc.- 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 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.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected QueryExceptiongenerateQueryException(String queryString)Called fromwrapWithQueryString(String)when we really need to generate a new QueryException (or subclass).StringgetMessage()protected StringgetOriginalMessage()StringgetQueryString()Retrieve the query being evaluated when the exception occurred.QueryExceptionwrapWithQueryString(String queryString)Wraps this exception with another, of same kind, with the specified queryString.
-
-
-
构造器详细资料
-
QueryException
public QueryException(String message)
Constructs a QueryException using the specified exception message.- 参数:
message- A message explaining the exception condition
-
QueryException
public QueryException(String message, Exception cause)
Constructs a QueryException using the specified exception message and cause.- 参数:
message- A message explaining the exception conditioncause- The underlying cause
-
QueryException
public 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 occurred
-
QueryException
public 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 cause
-
QueryException
public QueryException(Exception cause)
Constructs a QueryException using the specified cause.- 参数:
cause- The underlying cause
-
-
方法详细资料
-
getQueryString
public String getQueryString()
Retrieve the query being evaluated when the exception occurred. May be null, but generally should not.- 返回:
- The query string
-
getMessage
public String getMessage()
- 覆盖:
getMessage在类中Throwable
-
getOriginalMessage
protected final String getOriginalMessage()
-
wrapWithQueryString
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 protectedgenerateQueryException(String)is called, to allow subclasses to properly create the correct subclass for return.- 参数:
queryString- The query string that led to the QueryException- 返回:
this, ifthishasnullforgetQueryString(); otherwise a new QueryException (or subclass) is returned.
-
generateQueryException
protected QueryException generateQueryException(String queryString)
Called fromwrapWithQueryString(String)when we really need to generate a new QueryException (or subclass). NOTE : implementors should take care to usegetOriginalMessage()for the message, notgetMessage()- 参数:
queryString- The query string- 返回:
- The generated QueryException (or subclass)
- 另请参阅:
getOriginalMessage()
-
-