001package io.ebean.config.dbplatform.hsqldb;
002
003import io.ebean.BackgroundExecutor;
004import io.ebean.annotation.Platform;
005import io.ebean.config.dbplatform.DatabasePlatform;
006import io.ebean.config.dbplatform.DbPlatformType;
007import io.ebean.config.dbplatform.DbType;
008import io.ebean.config.dbplatform.IdType;
009import io.ebean.config.dbplatform.PlatformIdGenerator;
010import io.ebean.config.dbplatform.h2.H2DbEncrypt;
011import io.ebean.config.dbplatform.h2.H2SequenceIdGenerator;
012
013import javax.sql.DataSource;
014
015/**
016 * H2 specific platform.
017 */
018public class HsqldbPlatform extends DatabasePlatform {
019
020  public HsqldbPlatform() {
021    super();
022    this.platform = Platform.HSQLDB;
023    this.dbEncrypt = new H2DbEncrypt();
024    this.truncateTable = "delete from %s";
025    this.dbIdentity.setIdType(IdType.IDENTITY);
026    this.dbIdentity.setSupportsGetGeneratedKeys(true);
027    this.dbIdentity.setSupportsSequence(true);
028    this.dbIdentity.setSupportsIdentity(true);
029
030    dbTypeMap.put(DbType.INTEGER, new DbPlatformType("integer", false));
031  }
032
033  @Override
034  public PlatformIdGenerator createSequenceIdGenerator(BackgroundExecutor be, DataSource ds, int stepSize, String seqName) {
035    return new H2SequenceIdGenerator(be, ds, seqName, sequenceBatchSize);
036  }
037
038}