Page 1 of 1

Apache's Torque - any macros or clip libs avalible?

Posted: Thu Jan 29, 2004 10:52 pm
by davidakoontz
I've just started to use Apache's Torque (it builds the object-relational mapping Java classes & creates the DB tables - for you).

You have to define the tables via XML files that define the DB schema. Simple but wordy. Are there any macros or clip libs that would help with this stuff? Thanks!!

Here's an example of the file:

Code: Select all

<database
  name="bookstore"
  defaultIdMethod="idbroker">
  
  <table name="book" description="Book Table">
    <column
      name="book_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Book Id"/>
    <column
      name="title"
      required="true"
      type="VARCHAR"
      size="255"
      description="Book Title"/>
    <column
      name="isbn"
      required="true"
      type="VARCHAR"
      size="25"
      javaName="ISBN"
      description="Book ISBN"/>
    <column
      name="publisher_id"
      required="true"
      type="INTEGER"
      description="Foreign Key Publisher"/>
    <column
      name="author_id"
      required="true"
      type="INTEGER"
      description="Foreign Key Author"/>
    <foreign-key foreignTable="publisher">
      <reference
        local="publisher_id"
        foreign="publisher_id"/>
    </foreign-key>
    <foreign-key foreignTable="author">
       <reference
         local="author_id"
         foreign="author_id"/>
    </foreign-key>
  </table>

... blah, blah, blah