## org.h2.schema
Class Sequence

    java.lang.Object
      org.h2.engine.DbObjectBase
          org.h2.schema.SchemaObjectBase
              org.h2.schema.Sequence

All Implemented Interfaces:
  DbObject, SchemaObject

    public class Sequence

extends SchemaObjectBase

A sequence is created using the statement CREATE SEQUENCE

Field Summary
`static int` `DEFAULT_CACHE_SIZE` The default cache size for sequences.

Fields inherited from class org.h2.engine.DbObjectBase
`comment, database, trace`

Fields inherited from interface org.h2.engine.DbObject
`AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE`

Constructor Summary
`Sequence(Schema schema, int id, java.lang.String name, boolean belongsToTable)`

Method Summary
`void` `checkRename()` Check if this object can be renamed.
`void` `close()` Flush the current value to disk and close this object.
`void` `flush(Session session)` Flush the current value, including the margin, to disk.
`boolean` `getBelongsToTable()`
`long` `getCacheSize()`
`java.lang.String` `getCreateSQL()` Build a SQL statement to re-create this object.
`java.lang.String` `getCreateSQLForCopy(Table table, java.lang.String quotedName)` Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table
`long` `getCurrentValue()`
`java.lang.String` `getDropSQL()` Build a SQL statement to drop this object.
`long` `getIncrement()`
`long` `getNext(Session session)` Get the next value for this sequence.
`int` `getType()` Get the object type.
`void` `removeChildrenAndResources(Session session)` Remove all dependent objects and free all resources (files, blocks in files) of this object.
`void` `setBelongsToTable(boolean b)`
`void` `setCacheSize(long cacheSize)`
`void` `setIncrement(long inc)`
`void` `setStartValue(long value)`

Methods inherited from class org.h2.schema.SchemaObjectBase
`getSchema, getSQL, initSchemaObjectBase`

Methods inherited from class org.h2.engine.DbObjectBase
`getChildren, getComment, getDatabase, getHeadPos, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, rename, setComment, setModified, setObjectName, setTemporary, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.h2.engine.DbObject
`getChildren, getComment, getDatabase, getHeadPos, getId, getModificationId, getName, isTemporary, rename, setComment, setModified, setTemporary`

Field Detail

### DEFAULT_CACHE_SIZE

    public static final int DEFAULT_CACHE_SIZE

  The default cache size for sequences.

  See Also:
    Constant Field Values

Constructor Detail

### Sequence

    public Sequence(Schema schema,
                    int id,
                    java.lang.String name,
                    boolean belongsToTable)

Method Detail

### setStartValue

    public void setStartValue(long value)

### getBelongsToTable

    public boolean getBelongsToTable()

### getIncrement

    public long getIncrement()

### setIncrement

    public void setIncrement(long inc)
                      throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getDropSQL

    public java.lang.String getDropSQL()

  Description copied from class: `DbObjectBase`
  Build a SQL statement to drop this object.

  Specified by:
    `getDropSQL` in interface `DbObject`
  Specified by:
    `getDropSQL` in class `DbObjectBase`
  Returns:
    the SQL statement

### getCreateSQLForCopy

    public java.lang.String getCreateSQLForCopy(Table table,
                                                java.lang.String quotedName)

  Description copied from class: `DbObjectBase`
  Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table

  Specified by:
    `getCreateSQLForCopy` in interface `DbObject`
  Specified by:
    `getCreateSQLForCopy` in class `DbObjectBase`
  Parameters:
    `table` - the new table name
    `quotedName` - the new quoted name
  Returns:
    the SQL statement

### getCreateSQL

    public java.lang.String getCreateSQL()

  Description copied from class: `DbObjectBase`
  Build a SQL statement to re-create this object.

  Specified by:
    `getCreateSQL` in interface `DbObject`
  Specified by:
    `getCreateSQL` in class `DbObjectBase`
  Returns:
    the SQL statement

### getNext

    public long getNext(Session session)
                 throws java.sql.SQLException

  Get the next value for this sequence.

  Parameters:
    `session` - the session
  Returns:
    the next value
  Throws:
    `java.sql.SQLException`

### flush

    public void flush(Session session)
               throws java.sql.SQLException

  Flush the current value, including the margin, to disk.

  Parameters:
    `session` - the session
  Throws:
    `java.sql.SQLException`

### close

    public void close()
               throws java.sql.SQLException

  Flush the current value to disk and close this object.

  Throws:
    `java.sql.SQLException`

### getType

    public int getType()

  Description copied from class: `DbObjectBase`
  Get the object type.

  Specified by:
    `getType` in interface `DbObject`
  Specified by:
    `getType` in class `DbObjectBase`
  Returns:
    the object type

### removeChildrenAndResources

    public void removeChildrenAndResources(Session session)
                                    throws java.sql.SQLException

  Description copied from class: `DbObjectBase`
  Remove all dependent objects and free all resources (files, blocks in files) of this object.

  Specified by:
    `removeChildrenAndResources` in interface `DbObject`
  Specified by:
    `removeChildrenAndResources` in class `DbObjectBase`
  Parameters:
    `session` - the session
  Throws:
    `java.sql.SQLException`

### checkRename

    public void checkRename()

  Description copied from class: `DbObjectBase`
  Check if this object can be renamed. System objects may not be renamed.

  Specified by:
    `checkRename` in interface `DbObject`
  Specified by:
    `checkRename` in class `DbObjectBase`

### getCurrentValue

    public long getCurrentValue()

### setBelongsToTable

    public void setBelongsToTable(boolean b)

### setCacheSize

    public void setCacheSize(long cacheSize)

### getCacheSize

    public long getCacheSize()