From 6008264711a828f5b798157db068a3126422534e Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Mon, 18 Oct 2021 10:33:22 +0100 Subject: [PATCH] HHH-14816 Optimise LockMode#fromExternalForm for common case --- hibernate-core/src/main/java/org/hibernate/LockMode.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/LockMode.java b/hibernate-core/src/main/java/org/hibernate/LockMode.java index 18e5498df5..72a42843f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/LockMode.java +++ b/hibernate-core/src/main/java/org/hibernate/LockMode.java @@ -147,6 +147,12 @@ public enum LockMode { return NONE; } + for ( LockMode lockMode : LockMode.values() ) { + if ( lockMode.externalForm.equals( externalForm ) ) { + return lockMode; + } + } + for ( LockMode lockMode : LockMode.values() ) { if ( lockMode.externalForm.equalsIgnoreCase( externalForm ) ) { return lockMode;