mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 04:34:49 +00:00
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 int getTimeOut() {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* See {@link #getTimeOut} for a discussion of meaning.
|
* 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).
|
* @return this (for method chaining).
|
||||||
*
|
*
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.hibernate.dialect;
|
package org.hibernate.dialect;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||||
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorMariaDBDatabaseImpl;
|
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorMariaDBDatabaseImpl;
|
||||||
@ -72,7 +74,7 @@ public String getWriteLockString(int timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( timeout > 0 ) {
|
if ( timeout > 0 ) {
|
||||||
return getForUpdateString() + " wait " + timeout;
|
return getForUpdateString() + " wait " + getLockWaitTimeoutInSeconds( timeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
return getForUpdateString();
|
return getForUpdateString();
|
||||||
@ -88,4 +90,9 @@ public String getForUpdateNowaitString(String aliases) {
|
|||||||
return getForUpdateString( aliases ) + " nowait";
|
return getForUpdateString( aliases ) + " nowait";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long getLockWaitTimeoutInSeconds(int timeoutInMilliseconds) {
|
||||||
|
Duration duration = Duration.ofMillis( timeoutInMilliseconds );
|
||||||
|
return duration.getSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user