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: Evaluating the Torque Generator
Date Thu, 03 Aug 2006 16:53:25 GMT
 

> Robert Enyedi said on Thursday, August 03, 2006 10:03 AM
> 
> We are evaluating the Torque Generator for using it in our 
> product. We have heard many good words about the Torque 
> project and we would like to become faithful users and maybe 
> even contributors :-)

The more the merrier (and better coding...)

> Currently we use a MySQL 4 database in the back-end. We would 
> like to also be able to use the Derby and Oracle database 
> engines. For this the critical part is to have our current 
> MySQL schema transformed into the Torque XML DB schema.

Cross DB support is what got me into Torque as well.  IMHO,
Torque's an excellent choice for this.
 
> Using the torque-jdbc-transform Ant task, I have tried to 
> extract the Torque XML DB schema from our existing database. 
> While generally correct, the result had some things missing though:
> - the ENGINE=MyISAM option is present for some of our tables. 
> Is there something equivalent in Torque?
> - the FOREIGN KEY REFERENCE ON DELETE SET NULL sequence is 
> completely discarded,
> - the UNIQUE and ON DELETE CASCADE clauses are discarded,
> - information on INDEXES is discarded,
> - information on AUTO INCREMENT fields is discarded.
> 
> Could these be due to the limited database meta-information 
> provided by JDBC?

Partially do to JDBC limitation but I think it's mostly due to 
the JDBC task being more of a typing saver than a circular tool 
that can take any schema export it and regenerate it.  (But 
contributions to improve this are welcome).

>From your list though, you need to remember that Torque is
designed to encourage (but not enforce) cross DB support.  
Therefore DB specific items like ENGINE=MyISAM are not fully
supported in the general distribution (but folks have modified
the templates to locally support stuff like this).

> 
>  From the generated schema I generated back the MySQL schema 
> and saw some type mapping inconsistencies:
> - INTEGER was generated as MEDIUMINT (I found this to be a 
> but fixed in the 3.2.1 development branch),
> - DATE was generated as DATETIME,
> - DATETIME was generated as TIMESTAMP (this is correct, 
> though starting with MySQL 4),
> - BLOB becomes LONG BLOB,
> - BINARY NOT NULL becomes only NOT NULL (this is bad when 
> storing case sensitive strings, like path names),
> - MEDIUMTEXT becomes TEXT.

You have to keep in mind that in order to maintain cross DB
support, you really need to think of the XML Schema as your
starting point and not just a configuration file.  Once you 
get your existing schema mapped into XML, then start adding 
tables and changes via the XML, you can be sure that what is 
in the XML can have a reasonable matching schema created in 
ANY DB Torque supports. 

FWIW, for the most part, the mapping between DB specific 
types and Torque's XML types are done as much as possible 
in accordance with the SQL standards. ( I suspect that 
MySQL's LONG BLOB is a closer match to the SQL Standard 
definition of BLOB than MySQL's BLOB size.)

On the other hand, you can also just opt not use Torque's 
version of what the DB specific schema should be and 
use your own.  The XML becomes the mapping for generating
matching objects. On the Java side, if the JDBC driver
can map the SQL type to a Java Object, the Torque OM will
generally support it.  It doesn't care if the underlying
field is MEDIUMTEXT or TEXT/BLOB or LONGBLOB.  FYI - To 
turn off sql generation of a specific table, add the 
skipSql="false" attribute.


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