Class Table

  • Direct Known Subclasses:
    ClientTable, MonitoredTable

    public abstract class Table
    extends Object
    Top-level class for modeling SQL tables that have a single, unique key and can be modelled as maps of java objects. Each row in the table corresponds to a java object. The primary key is the key in the map. This class represents the bridge between java and SQL. Normally you must only implement the createColumnDescriptors() method to get all creation (yes! management too!!), inserts and updates automagically taken care of.

    Created by Jeff Gaynor
    on Apr 13, 2010 at 2:04:54 PM

    • Constructor Detail

      • Table

        public Table​(SerializationKeys keys,
                     String schema,
                     String tablenamePrefix,
                     String tablename)
        The schema and prefix are not part of the table's information, actually, but are needed to create its fully qualified name in context. Hence they must be supplied.
        Parameters:
        keys -
        schema -
        tablenamePrefix -
        tablename -
    • Method Detail

      • getFQTablename

        public String getFQTablename()
      • getTablename

        public String getTablename()
      • setTablename

        public void setTablename​(String tablename)
      • createColumnDescriptors

        public void createColumnDescriptors()
        Invoked to create all the descriptors for this table.
      • getCreateTableStatement

        public String getCreateTableStatement()
      • getPrimaryKeyColumnName

        public String getPrimaryKeyColumnName()
      • createTableStatement

        public String createTableStatement()
      • createSelectStatement

        public String createSelectStatement()
        Returns the select statement for this table with one parameter for the primary key.
        Returns:
      • createSelectAllStatement

        public String createSelectAllStatement()
        Returns the select statement for this table with one parameter for the primary key.
        Returns:
      • createRegisterStatement

        public String createRegisterStatement()
      • getTablenamePrefix

        public String getTablenamePrefix()
      • getSchema

        public String getSchema()
      • setTablenamePrefix

        public void setTablenamePrefix​(String tablenamePrefix)
      • fqTablename

        protected String fqTablename​(String name)
      • createUpdateStatement

        public String createUpdateStatement()
        An update statement has all columns, except, the primary key, which is used to create the where clause.
        Returns:
      • createInsertStatement

        public String createInsertStatement()
        Creates a new insert statement with every column. This is used in the SQLStore.register(Identifiable) call, e.g.
        Returns:
      • createMassInsertStatement

        public String createMassInsertStatement()