db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: AW: Need a sample Torque application
Date Tue, 17 Oct 2006 15:27:29 GMT
Here's the basics for this step...

Before running "maven torque" in project directory:

project
|   project.properties
|
+---src
    +---java
    +---schema
            bookstore-schema.xml
            id-table-schema.xml

After running "maven torque" project directory:

project
|   project.properties
|   velocity.log
|
+---src
|   +---java
|   |   |   report.bookstore.om.generation
|   |   |
|   |   +---my
|   |   |   +---torque
|   |   |       +---om
|   |   |           |   Author.java
|   |   |           |   AuthorPeer.java
|   |   |           |   BaseAuthor.java
|   |   |           |   BaseAuthorPeer.java
|   |   |           |   BaseBook.java
|   |   |           |   BaseBookPeer.java
|   |   |           |   BasePublisher.java
|   |   |           |   BasePublisherPeer.java
|   |   |           |   Book.java
|   |   |           |   BookPeer.java
|   |   |           |   Publisher.java
|   |   |           |   PublisherPeer.java
|   |   |           |
|   |   |           +---map
|   |   |                   AuthorMapBuilder.java
|   |   |                   BookMapBuilder.java
|   |   |                   BookstoreMapInit.java
|   |   |                   PublisherMapBuilder.java
|   |   |
|   |   +---org
|   |       +---apache
|   |           +---torque
|   |               +---linkage
|   |                       BookstoreMapInit.java
|   |
|   +---schema
|           bookstore-schema.xml
|           id-table-schema.xml
|
+---target
    +---sql
            bookstore-schema.sql
            id-table-schema.sql
            report.bookstore.sql.generation
            sqldb.map

project.properties:
==============================================================
# The name of the project Torque will generate code for.
torque.project = bookstore

# The target database platform.
torque.database = mssql

# The target package to put the generated classes in.
torque.targetPackage = my.torque.om

# The JDBC URL that Torque can use to create and
# drop databases if instructed to do so.
torque.database.createUrl = jdbc:mysql://127.0.0.1/mysql

# The JDBC URL that will be used to create tables in your database.
torque.database.buildUrl = jdbc:mysql://127.0.0.1/bookstore

# The JDBC URL that will be used to access your database.
torque.database.url = jdbc:mysql://127.0.0.1/bookstore

# The JDBC database driver to use when connecting to your database.
torque.database.driver = org.gjt.mm.mysql.Driver

# The administrative username that has sufficient privileges to create
# and drop databases and tables that Torque executes at generation time.
torque.database.user = adminuser

# The administrative password for the supplied username.
torque.database.password = adminpassword
===========================================================

Contents of bookstore-schema.xml
===========================================================
<!DOCTYPE database SYSTEM
 "http://db.apache.org/torque/dtd/database_3_2.dtd">

<database
  name="bookstore"
  defaultIdMethod="idbroker">

  <table name="publisher" description="Publisher Table">
    <column
      name="publisher_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Publisher Id"/>
    <column
      name="name"
      required="true"
      type="VARCHAR"
      size="128"
      description="Publisher Name"/>
  </table>
  <table name="author" description="Author Table">
    <column
      name="author_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Author Id"/>
    <column
      name="first_name"
      required="true"
      type="VARCHAR"
      size="128"
      description="First Name"/>
    <column
      name="last_name"
      required="true"
      type="VARCHAR"
      size="128"
      description="Last Name"/>
  </table>
  <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="24"
      javaName="ISBN"
      description="ISBN Number"/>
    <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>
</database>
========================================================

Contents of id-table-schema.xml
========================================================
<!DOCTYPE database SYSTEM
 "http://db.apache.org/torque/dtd/database_3_2.dtd">

<database name="bookstore">
  <table name="ID_TABLE" idMethod="idbroker">
    <column
      name="ID_TABLE_ID"
      required="true"
      primaryKey="true"
      type="INTEGER"/>
    <column
      name="TABLE_NAME"
      required="true"
      size="255"
      type="VARCHAR"/>
    <column
      name="NEXT_ID"
      type="INTEGER"/>
    <column
      name="QUANTITY"
      type="INTEGER"/>
    <unique>
      <unique-column name="TABLE_NAME"/>
    </unique>
  </table>
</database> 
=======================================================
> -----Original Message-----
> From: anand.kulkarni@e-zest.net [mailto:anand.kulkarni@e-zest.net] 
> Sent: Tuesday, October 17, 2006 8:55 AM
> To: Apache Torque Users List
> Subject: Re: AW: Need a sample Torque application
> 
> Hi,
> 
> I have configured them. There is no error in Maven. I am 
> following the Torque tutorial provided by Apache torque website. 
> 
> According to the tutorial, we get database mapping classes 
> created by the torque. Refer: 
> http://db.apache.org/torque/releases/torque-3.2/tutorial/step3.html
> 
> But its not creating expected classes in my case. Instead of 
> that it is creating few Turbine classes inside src/java directory. 
> 
> Hence, I need a sample working Torque application.
> 
> If you have it, kindly forward it to me.
> 
> Thanks.
> regards,
> 
> Anand
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message