How-To: Add new tables to the data model

From FactorityWiki

Jump to: navigation, search

Introduction

Step by Step

  • Login with the AS+ Eclipse plugin to your running AS+ instance
  • Create an XML file with the following naming schema: DbFyMyBusinessObject.dbm.xml (Fy is the partition's Name)
    for example in /Fy@localhost_18000/src/com/factority/core/db/


  <?xml version="1.0" encoding="UTF-8"?>
 
  <asplus-mapping>
	<class lazy="false" transaction-domain="DbMain" table="FY_MY_BUSINESS_OBJECT">
 
	       <property name="objectName"
                  type="String"
                  not-null="false"
                  length="128"/>
 
 
        <property name="eventTime"
                  type="Date"
                  not-null="true"/>
	</class>
  </asplus-mapping>



  DELETE FROM ASPLUS_SCHEMA WHERE tablename = 'FY_MY_BUSINESS_OBJECT';
  DELETE FROM ASPLUS_SCHEMA_SPECLINE WHERE tablename = 'FY_MY_BUSINESS_OBJECT';
  INSERT INTO ASPLUS_SCHEMA (tablename, classname, version) VALUES ('SFA_BACKGROUND_JOBS', 'com.factority.core.db.DbFyMyBusinessObject', 0);
 
 
  CREATE TABLE FY_MY_BUSINESS_OBJECT (
    pk numeric(14) NOT NULL,
    version numeric(9) NOT NULL,
    objectName varchar(128),
    eventTime date NOT NULL,
    CONSTRAINT PK_FY_MY_BUSINESS_OBJECT PRIMARY KEY (pk)
  );


  • Login to the database with PgAdminIII
  • Be aware of the table owner !
  • Execute the SQL commands
Personal tools