org.h2.engine

## Class DbObjectBase

- java.lang.Object
- - org.h2.engine.DbObjectBase

All Implemented Interfaces:
  DbObject

Direct Known Subclasses:
  Comment, Right, RightOwner, Schema, SchemaObjectBase, Setting, UserAggregate, UserDataType

    public abstract class DbObjectBase
    extends java.lang.Object
    implements DbObject

The base class for all database objects.

### Field Summary

Fields
`protected java.lang.String` `comment` The comment (if set).
`protected Database` `database` The database.
`protected Trace` `trace` The trace module.

### 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

Constructors
Constructor and Description
`DbObjectBase()`

### Method Summary

Methods
`abstract void` `checkRename()` Check if this object can be renamed.
`java.util.ArrayList<DbObject>` `getChildren()` Get the list of dependent children (for tables, this includes indexes and so on).
`java.lang.String` `getComment()` Get the current comment of this object.
`abstract java.lang.String` `getCreateSQL()` Build a SQL statement to re-create this object.
`Database` `getDatabase()` Get the database.
`abstract java.lang.String` `getDropSQL()` Build a SQL statement to drop this object.
`int` `getId()` Get the unique object id.
`long` `getModificationId()`
`java.lang.String` `getName()` Get the name.
`java.lang.String` `getSQL()` Get the SQL name of this object (may be quoted).
`protected void` `initDbObjectBase(Database db, int objectId, java.lang.String name, int traceModuleId)` Initialize some attributes of this object.
`protected void` `invalidate()` Set the main attributes to null to make sure the object is no longer used.
`boolean` `isTemporary()` Check if this object is temporary (for example, a temporary table).
`boolean` `isValid()`
`abstract void` `removeChildrenAndResources(Session session)` Remove all dependent objects and free all resources (files, blocks in files) of this object.
`void` `rename(java.lang.String newName)` Rename the object.
`void` `setComment(java.lang.String comment)` Change the comment of this object.
`void` `setModified()` Tell the object that is was modified.
`protected void` `setObjectName(java.lang.String name)`
`void` `setTemporary(boolean temporary)` Tell this object that it is temporary or not.
`java.lang.String` `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

`getCreateSQLForCopy, getType`

### Field Detail

#### database

    protected Database database

The database.

#### trace

    protected Trace trace

The trace module.

#### comment

    protected java.lang.String comment

The comment (if set).

### Constructor Detail

#### DbObjectBase

    public DbObjectBase()

### Method Detail

#### initDbObjectBase

    protected void initDbObjectBase(Database db,
                        int objectId,
                        java.lang.String name,
                        int traceModuleId)

Initialize some attributes of this object.

Parameters:
  `db` - the database
  `objectId` - the object id
  `name` - the name
  `traceModuleId` - the trace module id

#### getCreateSQL

    public abstract java.lang.String getCreateSQL()

Build a SQL statement to re-create this object.

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

#### getDropSQL

    public abstract java.lang.String getDropSQL()

Build a SQL statement to drop this object.

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

#### removeChildrenAndResources

    public abstract void removeChildrenAndResources(Session session)

Remove all dependent objects and free all resources (files, blocks in files) of this object.

Specified by:
  `removeChildrenAndResources` in interface `DbObject`
Parameters:
  `session` - the session

#### checkRename

    public abstract void checkRename()

Check if this object can be renamed. System objects may not be renamed.

Specified by:
  `checkRename` in interface `DbObject`

#### setModified

    public void setModified()

Tell the object that is was modified.

#### getModificationId

    public long getModificationId()

#### setObjectName

    protected void setObjectName(java.lang.String name)

#### getSQL

    public java.lang.String getSQL()

Description copied from interface: `DbObject`
Get the SQL name of this object (may be quoted).

Specified by:
  `getSQL` in interface `DbObject`
Returns:
  the SQL name

#### getChildren

    public java.util.ArrayList<DbObject> getChildren()

Description copied from interface: `DbObject`
Get the list of dependent children (for tables, this includes indexes and so on).

Specified by:
  `getChildren` in interface `DbObject`
Returns:
  the list of children

#### getDatabase

    public Database getDatabase()

Description copied from interface: `DbObject`
Get the database.

Specified by:
  `getDatabase` in interface `DbObject`
Returns:
  the database

#### getId

    public int getId()

Description copied from interface: `DbObject`
Get the unique object id.

Specified by:
  `getId` in interface `DbObject`
Returns:
  the object id

#### getName

    public java.lang.String getName()

Description copied from interface: `DbObject`
Get the name.

Specified by:
  `getName` in interface `DbObject`
Returns:
  the name

#### invalidate

    protected void invalidate()

Set the main attributes to null to make sure the object is no longer used.

#### isValid

    public final boolean isValid()

#### rename

    public void rename(java.lang.String newName)

Description copied from interface: `DbObject`
Rename the object.

Specified by:
  `rename` in interface `DbObject`
Parameters:
  `newName` - the new name

#### isTemporary

    public boolean isTemporary()

Description copied from interface: `DbObject`
Check if this object is temporary (for example, a temporary table).

Specified by:
  `isTemporary` in interface `DbObject`
Returns:
  true if is temporary

#### setTemporary

    public void setTemporary(boolean temporary)

Description copied from interface: `DbObject`
Tell this object that it is temporary or not.

Specified by:
  `setTemporary` in interface `DbObject`
Parameters:
  `temporary` - the new value

#### setComment

    public void setComment(java.lang.String comment)

Description copied from interface: `DbObject`
Change the comment of this object.

Specified by:
  `setComment` in interface `DbObject`
Parameters:
  `comment` - the new comment, or null for no comment

#### getComment

    public java.lang.String getComment()

Description copied from interface: `DbObject`
Get the current comment of this object.

Specified by:
  `getComment` in interface `DbObject`
Returns:
  the comment, or null if not set

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`