Questions tagged [ddlutils]

DdlUtils is an apache utility which generates database schemas (tables, fields) for multiple databases using a common XML format.

Apache DdlUtils is an apache utility which can generate database DDL for multiple databases from a common XML format. Examples of target databases might be PostgreSQL, HSqlDB or Oracle.

An XML definition for a simple database might look like:

<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database.dtd">
<database name="stackoverflow">
  <table name="question">
    <column name="question_id"
            type="VARCHAR"
            size="40"
            primaryKey="true"
            required="true"/>
    <column name="title"
            type="VARCHAR"
            size="50"
            required="true"/>
    <column name="user_id"
            type="INTEGER"
            required="true"/>
    <column name="question"
            type="VARCHAR"
            size="255"
            required="true"/>
  </table>

  <table name="answers">
    <column name="answer_id"
            type="INTEGER"
            required="true"
            primaryKey="true"
            autoIncrement="true"/>
    <column name="question_id"
            type="VARCHAR"
            size="40"
            required="true"/>
    <column name="user_id"
            type="INTEGER"
            required="true"/>
    <column name="markdown"
            type="VARCHAR"
            size="255"
            defaultValue=""
            required="true"/>

    <foreign-key foreignTable="question">
      <reference local="question_id" foreign="question_id"/>
    </foreign-key>  

    <index name="user_id_idx">
      <index-column name="user_id"/>
    </index>
  </table>
</database>

DdlUtils includes integration with Ant for:

  • Generating database DDL from a supplied XML file (model)
  • Generating the DdlUtils XML model from an existing database.

Useful links:

18 questions
0
votes
1 answer

DDLUtils not exporting Mysql data using ant script

I want to export mysql database using ddlutils tool in ant
nutim
  • 169
  • 3
  • 15
0
votes
3 answers

DDLUtils and autoincrement values

When trying to use DDLUtils it always seems to take over the id values for the columns that are set to autoincrement. How can I prevent this? For example, I have a Dogs table with a column called ownerID. The column ownerID is set to autoincrement.…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
0
votes
1 answer

Apache DdlUtils :: how to obtain the sequence name for auto-increment keys?

I am using Apache DdlUtils to query a PostgreSQL database for table and column meta-data (the end-aim being to automatically generate javax.persistence-annotated entity beans). However it seems to me that the DdlUtils library does not provide a way…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
1
2