diff --git a/hibernate-core/src/main/java/org/hibernate/exception/spi/TemplatedViolatedConstraintNameExtracter.java b/hibernate-core/src/main/java/org/hibernate/exception/spi/TemplatedViolatedConstraintNameExtracter.java index 193150c9bf..303d2be611 100644 --- a/hibernate-core/src/main/java/org/hibernate/exception/spi/TemplatedViolatedConstraintNameExtracter.java +++ b/hibernate-core/src/main/java/org/hibernate/exception/spi/TemplatedViolatedConstraintNameExtracter.java @@ -46,7 +46,7 @@ public abstract class TemplatedViolatedConstraintNameExtracter implements Violat } int start = templateStartPosition + templateStart.length(); - int end = message.lastIndexOf( templateEnd, start ); + int end = message.indexOf( templateEnd, start ); if ( end < 0 ) { end = message.length(); }