diff --git a/hibernate-core/src/main/java/org/hibernate/LockOptions.java b/hibernate-core/src/main/java/org/hibernate/LockOptions.java index a25fc84b71..7593d1c9f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/LockOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/LockOptions.java @@ -245,7 +245,7 @@ public class LockOptions implements Serializable { *

* See {@link #getTimeOut} for a discussion of meaning. * - * @param timeout The new timeout setting. + * @param timeout The new timeout setting, in milliseconds * * @return this (for method chaining). * diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java index 808d124824..f95ef92872 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB103Dialect.java @@ -6,6 +6,8 @@ */ package org.hibernate.dialect; +import java.time.Duration; + import org.hibernate.LockOptions; import org.hibernate.dialect.function.StandardSQLFunction; import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorMariaDBDatabaseImpl; @@ -72,7 +74,7 @@ public class MariaDB103Dialect extends MariaDB102Dialect { } if ( timeout > 0 ) { - return getForUpdateString() + " wait " + timeout; + return getForUpdateString() + " wait " + getLockWaitTimeoutInSeconds( timeout ); } return getForUpdateString(); @@ -88,4 +90,9 @@ public class MariaDB103Dialect extends MariaDB102Dialect { return getForUpdateString( aliases ) + " nowait"; } + private static long getLockWaitTimeoutInSeconds(int timeoutInMilliseconds) { + Duration duration = Duration.ofMillis( timeoutInMilliseconds ); + return duration.getSeconds(); + } + }