HHH-14350 MariaDB103Dialect requires the lock wait timeout to be expressed in seconds
This commit is contained in:
parent
3de7fb653e
commit
53a5c7fa97
|
@ -245,7 +245,7 @@ public class LockOptions implements Serializable {
|
|||
* <p/>
|
||||
* 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).
|
||||
*
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue