From d43f618ebaf8c0c70d285d967d46affef2b5b19e Mon Sep 17 00:00:00 2001 From: Gavin Date: Mon, 12 Jun 2023 23:38:01 +0200 Subject: [PATCH] deprecated some exception constructors we need to migrate away from it's really important to report the actual HQL that caused the failure --- .../main/java/org/hibernate/QueryException.java | 12 ++++++++++++ .../org/hibernate/query/SemanticException.java | 15 +++++++++++++++ .../query/sqm/InterpretationException.java | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/QueryException.java b/hibernate-core/src/main/java/org/hibernate/QueryException.java index 9200537e3d..5e4afc5b38 100644 --- a/hibernate-core/src/main/java/org/hibernate/QueryException.java +++ b/hibernate-core/src/main/java/org/hibernate/QueryException.java @@ -17,7 +17,11 @@ public class QueryException extends HibernateException { * Constructs a {@code QueryException} using the specified exception message. * * @param message A message explaining the exception condition + * + * @deprecated this constructor does not carry information + * about the query which caused the failure */ + @Deprecated(since = "6.3") public QueryException(String message) { this( message, null, null ); } @@ -27,7 +31,11 @@ public class QueryException extends HibernateException { * * @param message A message explaining the exception condition * @param cause The underlying cause + * + * @deprecated this constructor does not carry information + * about the query which caused the failure */ + @Deprecated(since = "6.3") public QueryException(String message, Exception cause) { this( message, null, cause ); } @@ -58,7 +66,11 @@ public class QueryException extends HibernateException { * Constructs a {@code QueryException} using the specified cause. * * @param cause The underlying cause + * + * @deprecated this constructor does not carry information + * about the query which caused the failure */ + @Deprecated(since = "6.3") public QueryException(Exception cause) { this( "A query exception occurred", null, cause ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/SemanticException.java b/hibernate-core/src/main/java/org/hibernate/query/SemanticException.java index 9918ecd7f7..063ff3a78a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/SemanticException.java +++ b/hibernate-core/src/main/java/org/hibernate/query/SemanticException.java @@ -13,14 +13,29 @@ package org.hibernate.query; * @author Steve Ebersole */ public class SemanticException extends org.hibernate.QueryException { + + /** + * @deprecated this constructor does not carry information + * about the query which caused the failure + */ + @Deprecated(since = "6.3") public SemanticException(String message) { super( message ); } + /** + * @deprecated this constructor does not carry information + * about the query which caused the failure + */ + @Deprecated(since = "6.3") public SemanticException(String message, Exception cause) { super( message, cause ); } + public SemanticException(String message, String queryString) { + super( message, queryString ); + } + public SemanticException(String message, String queryString, Exception cause) { super( message, queryString, cause ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/InterpretationException.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/InterpretationException.java index 884e9a57fe..eb43389b52 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/InterpretationException.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/InterpretationException.java @@ -10,7 +10,7 @@ import org.hibernate.QueryException; /** * Represents a general uncaught problem performing the interpretation. - * This usually indicate a semantic error in the query. + * This usually indicates a semantic error in the query. * * @author Steve Ebersole */