Class DefaultTableGenerator


  • public class DefaultTableGenerator
    extends Object
    DefaultTableGenerator is a utility class used to generate a default table schema for a EclipseLink project object. The utility can be used in EclipseLink CMP for OC4J to perform the table auto creation process, which can be triggered at deployment time when EclipseLink project descriptor is absent (default mapping) or present. The utility can also be used to any EclipseLink application to perform the table drop/creation at runtime. The utility handles all direct/relational mappings, inheritance, multiple tables, interface with/without tables, optimistic version/timestamp lockings, nested relationships, BLOB/CLOB generation. The utility is platform-agnostic. Usage: - CMP 1. set "autocreate-tables=true|false, autodelete-tables=true|false" in oc4j application deployment descriptor files (config/system-application.xml, config/application.xml, or orion-application.xml in an .ear) 2. Default Mapping: the same as CMP, plus system properties setting -Declipselink.defaultmapping.autocreate-tables='true|false' and -Declipselink.defaultmapping.autodelete-tables='true|false' - Non-CMP: 1. Configuration: through sessions.xml 2. Directly runtime call through schema framework: SchemaManager mgr = new SchemaManager(session); mgr.replaceDefaultTables(); //drop and create mgr.createDefaultTables(); //create only The utility currently only supports relational project.
    Since:
    Oracle TopLink 10.1.3
    Author:
    King Wang
    • Constructor Detail

      • DefaultTableGenerator

        public DefaultTableGenerator​(Project project)
        Default constructor
      • DefaultTableGenerator

        public DefaultTableGenerator​(Project project,
                                     boolean generateFKConstraints)
        This constructor will create a DefaultTableGenerator that can be set to create fk constraints
    • Method Detail

      • generateDefaultTableCreator

        public TableCreator generateDefaultTableCreator()
        Generate a default TableCreator object from the EclipseLink project object.
      • generateFilteredDefaultTableCreator

        public TableCreator generateFilteredDefaultTableCreator​(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                                         throws DatabaseException
        Generate a default TableCreator object from the EclipseLink project object, and perform the table existence check through jdbc table metadata, and filter out tables which are already in the database.
        Throws:
        DatabaseException