mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-07 18:29:29 +00:00
HHH-18674 Expose result count of NonUniqueResultException
This commit is contained in:
parent
40591ada20
commit
c66b27d193
@ -15,6 +15,9 @@
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class NonUniqueResultException extends HibernateException {
|
||||
|
||||
private final int resultCount;
|
||||
|
||||
/**
|
||||
* Constructs a {@code NonUniqueResultException}.
|
||||
*
|
||||
@ -22,6 +25,15 @@ public class NonUniqueResultException extends HibernateException {
|
||||
*/
|
||||
public NonUniqueResultException(int resultCount) {
|
||||
super( "Query did not return a unique result: " + resultCount + " results were returned" );
|
||||
this.resultCount = resultCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of actual results.
|
||||
* @return number of actual results
|
||||
*/
|
||||
public int getResultCount() {
|
||||
return this.resultCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user