org.hibernate.dialect.MariaDB103Dialect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.dialect;
import java.time.Duration;
import org.hibernate.LockOptions;
/**
* An SQL dialect for MariaDB 10.3 and later, provides sequence support, lock-timeouts, etc.
*
* @author Philippe Marschall
*
* @deprecated use {@code MariaDBDialect(1030)}
*/
@Deprecated
public class MariaDB103Dialect extends MariaDBDialect {
public MariaDB103Dialect() {
super( DatabaseVersion.make( 10, 3 ) );
}
@Override
public String getWriteLockString(int timeout) {
if ( timeout == LockOptions.NO_WAIT ) {
return getForUpdateNowaitString();
}
if ( timeout > 0 ) {
return getForUpdateString() + " wait " + getLockWaitTimeoutInSeconds( timeout );
}
return getForUpdateString();
}
private static long getLockWaitTimeoutInSeconds(int timeoutInMilliseconds) {
Duration duration = Duration.ofMillis( timeoutInMilliseconds );
return duration.getSeconds();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy