db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thoralf Rickert" <thoralf.rick...@cadooz.de>
Subject XML-Description to Java & SQL Comment
Date Thu, 15 Dec 2005 17:06:18 GMT

I've a small feature request...

In the XML schema it is possible to declare descriptions on table an
column tags. I think, this attribute is currently unused. I've made some
changes in the OM templates and now I can see this descriptions in the
comments in the generated java classes (so it's easier to understand
what a setter or getter method means).

Additionally I made this changes in the mysql templates table and column
and now I can see this description also in the database (for example via
phpMyAdmin). I'm not sure if this syntax is also usable in other
database types...

Here are my changes (for the moment):

om/Object.vm (SVN345880):
 At the top of the class is a Java comment area, which I've 
 enhanced with a new line before line 74:
  * $!{table.description}
 In the foreach loop where the setters and getters are generated
 I've added the following line to the java comment (line 148 and 170).

In om/Peer.vm, om/ExtensionPeer.vm and om/ExtensionObject.vm I've added
only the table comment ($!table.description} in the javaclass comment
(line 55,17 and 27). That's it.

The SQL generation in MySQL isn't so easy, because I'm using currently
Torque 3.1. Here are the theoretical changes:
    #set($description=" COMMENT='$table.description'")

And then replace the ");" with )${description};

The columns can only be changed by changing the java source code in
org.apache.torque.engine.database.model.Column.getSqlString() (why
that?). But it's like the changes in the table.vm. The syntax is like
absentee_id BIGINT NOT NULL COMMENT 'my comment',

Maybe someone finds this useful and wants to use/implement it.


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

View raw message