All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.jdbc.support.incrementer.HsqlSequenceMaxValueIncrementer Maven / Gradle / Ivy

There is a newer version: 5.3.35
Show newest version
package org.springframework.jdbc.support.incrementer;

import javax.sql.DataSource;

/**
 * DataFieldMaxValueIncrementer that retrieves the next value of a given HSQL sequence.
 * Thanks to Guillaume Bilodeau for the suggestion!
 *
 * NOTE: This is an alternative to using a regular table to support generating unique keys that
 * was necessary in previous versions of HSQL.
 *
 * @author Thomas Risberg
 * @see org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer
 */
public class HsqlSequenceMaxValueIncrementer extends AbstractSequenceMaxValueIncrementer {

	/**
	 * Default constructor.
	 **/
	public HsqlSequenceMaxValueIncrementer() {
	}

	/**
	 * Convenience constructor.
	 * @param ds the DataSource to use
	 * @param incrementerName the name of the sequence to use
	 */
	public HsqlSequenceMaxValueIncrementer(DataSource ds, String incrementerName) {
		setDataSource(ds);
		setIncrementerName(incrementerName);
		afterPropertiesSet();
	}

	protected String getSequenceQuery() {
		return "call next value for " + getIncrementerName();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy