Code example for LockMode

Methods: greaterThanlessThan

0
 */ 
public class FrontBaseDialect extends Dialect {
 
	public FrontBaseDialect() { 
		super(); 
 
		registerColumnType( Types.BIT, "bit" );
		registerColumnType( Types.BIGINT, "longint" );
		registerColumnType( Types.SMALLINT, "smallint" );
		registerColumnType( Types.TINYINT, "tinyint" );
		registerColumnType( Types.INTEGER, "integer" );
		registerColumnType( Types.CHAR, "char(1)" );
		registerColumnType( Types.VARCHAR, "varchar($l)" );
		registerColumnType( Types.FLOAT, "float" );
		registerColumnType( Types.DOUBLE, "double precision" );
		registerColumnType( Types.DATE, "date" );
		registerColumnType( Types.TIME, "time" );
		registerColumnType( Types.TIMESTAMP, "timestamp" );
		registerColumnType( Types.VARBINARY, "bit varying($l)" );
		registerColumnType( Types.NUMERIC, "numeric($p,$s)" );
		registerColumnType( Types.BLOB, "blob" );
		registerColumnType( Types.CLOB, "clob" );
	} 
 
	public String getAddColumnString() {
		return "add column"; 
	} 
 
	public String getCascadeConstraintsString() {
		return " cascade"; 
	} 
 
	public boolean dropConstraints() { 
		return false; 
	} 
 
	/** 
	 * Does this dialect support the <tt>FOR UPDATE</tt> syntax. No! 
	 * 
	 * @return false always. FrontBase doesn't support this syntax, 
	 * which was dropped with SQL92 
	 */ 
	public String getForUpdateString() {
		return ""; 
	} 
 
	public String getCurrentTimestampCallString() {
		// TODO : not sure this is correct, could not find docs on how to do this. 
		return "{?= call current_timestamp}"; 
	} 
 
	public boolean isCurrentTimestampSelectStringCallable() { 
		return true; 
	} 
 
	public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
		// Frontbase has no known variation of a "SELECT ... FOR UPDATE" syntax... 
		if ( lockMode==LockMode.PESSIMISTIC_FORCE_INCREMENT) {
			return new PessimisticForceIncrementLockingStrategy( lockable, lockMode);
		} 
		else if ( lockMode==LockMode.PESSIMISTIC_WRITE) {
			return new PessimisticWriteUpdateLockingStrategy( lockable, lockMode);
		} 
		else if ( lockMode==LockMode.PESSIMISTIC_READ) {
			return new PessimisticReadUpdateLockingStrategy( lockable, lockMode);
		} 
		else if ( lockMode==LockMode.OPTIMISTIC) {
			return new OptimisticLockingStrategy( lockable, lockMode);
		} 
		else if ( lockMode==LockMode.OPTIMISTIC_FORCE_INCREMENT) {
			return new OptimisticForceIncrementLockingStrategy( lockable, lockMode);
		} 
		else if ( lockMode.greaterThan( LockMode.READ ) ) {
			return new UpdateLockingStrategy( lockable, lockMode );
		} 
		else { 
			return new SelectLockingStrategy( lockable, lockMode );
		} 
	} 
}