In openbravo ERP application, tables are created through XML files, which are parsed through SAX parser and created using a Java class GenerateEntityTask.
The sample xml file is as follows -
<?xml version="1.0"?>
<database name="TABLE RESPOS_KOT">
<table name="RESPOS_KOT" primaryKey="RESPOS_KOT_KEY">
<column name="RESPOS_KOT_ID" primaryKey="true" required="true" type="INTEGER" size="32" autoIncrement="false">
<default/>
<onCreateDefault/>
</column>
<column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false">
<default/>
<onCreateDefault/>
</column>
</table>
</database>
I want to add a sequence to the postgres database & increment the RESPOS_KOT_ID column by 1 for every insertion. I did that from sql shell as -
create sequence kot_sequence increment by 1 start 1;
CREATE TABLE RESPOS_KOT (
id INT4 DEFAULT nextval('kot_sequence') NOT NULL,
name VARCHAR(60)
);
INSERT INTO RESPOS_KOT (name) VALUES ('Testing respos KOT');
How can i create the same in the xml format. Any suggestions would be of great help, Thanks!!!
Tables are created through xml's only as you mentioned , However the xml's can also be generated by openbravo ant task-ant export.database.
steps may help you to create an xml for the above table is,