slightly improve format of error message
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
9346c28c8e
commit
84cdd7c93f
|
@ -495,7 +495,8 @@ public class QuerySqmImpl<R>
|
|||
}
|
||||
catch (IllegalQueryOperationException e) {
|
||||
// per JPA
|
||||
throw new IllegalStateException( "Expecting a SELECT query : `" + hql + "`", e );
|
||||
throw new IllegalStateException( "Query executed via 'getResultList()' or 'getSingleResult()' must be a 'select' query ["
|
||||
+ hql + "]", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -656,7 +657,8 @@ public class QuerySqmImpl<R>
|
|||
}
|
||||
catch (IllegalQueryOperationException e) {
|
||||
// per JPA
|
||||
throw new IllegalStateException( "Expecting a non-SELECT query : `" + hql + "`", e );
|
||||
throw new IllegalStateException( "Query executed via 'executeUpdate()' must be an 'insert', 'update', or 'delete' statement ["
|
||||
+ hql + "]", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class QueryApiTests {
|
|||
catch (IllegalStateException ise) {
|
||||
assertThat( ise.getCause() ).isNotNull();
|
||||
assertThat( ise.getCause() ).isInstanceOf( IllegalQueryOperationException.class );
|
||||
assertThat( ise.getMessage() ).endsWith( "`" + hql + "`" );
|
||||
assertThat( ise.getMessage() ).endsWith( "[" + hql + "]" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class QueryApiTests {
|
|||
catch (IllegalStateException ise) {
|
||||
assertThat( ise.getCause() ).isNotNull();
|
||||
assertThat( ise.getCause() ).isInstanceOf( IllegalQueryOperationException.class );
|
||||
assertThat( ise.getMessage() ).endsWith( "`" + hql + "`" );
|
||||
assertThat( ise.getMessage() ).endsWith( "[" + hql + "]" );
|
||||
}
|
||||
} );
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class QueryApiTests {
|
|||
catch (IllegalStateException ise) {
|
||||
assertThat( ise.getCause() ).isNotNull();
|
||||
assertThat( ise.getCause() ).isInstanceOf( IllegalQueryOperationException.class );
|
||||
assertThat( ise.getMessage() ).endsWith( "`" + hql + "`" );
|
||||
assertThat( ise.getMessage() ).endsWith( "[" + hql + "]" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue