db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Gordon <rgor...@mwt.net>
Subject Re: Torque Objects for multiple databases
Date Mon, 02 Feb 2004 19:14:47 GMT


Humberto Hernandez Torres wrote:

> AFIK. The torque OMs can work gainst any database.

This is not true. The Peer code has the database name for which they were
generated hardcoded into them. Although, there are some methods which
give impression you can change the database for which a OM class is
targeted (eg. new Criteria(databaseName), if you actually try to use them,
the code will fail b/c no database map*  has been built for the database
named at runtime. The database map is built/maintained by the
<tableName>MapBuilder
class that is generated as part of the OM generation. This class has a
doBuild()
method called when it is loaded that intiailizes databasemap for the database
named when it was generated.

What is needed is a way to a) assign an OM table to a database at runtime via
the Peer and b) ability to generate database maps for a database other than the

one for which OM was generated.

It just so happens that I have a working solution to this problem which I
can share if you want to contact me privately. I have not taken a "bug
report" on scarab with my "fix" yet, though I have been instructed to do
so by a developer. It is quite an easy patch, touching two templates
(MapBuilder and Peer) and one class util/BasePeer.

Rob


* The database map is the table/column info for a table.

> The sql files do need to
> be generated for the specific database.
> --
>   Humberto
>
> > -----Original Message-----
> > From: Eric Pugh [mailto:epugh@upstate.com]
> > Sent: Monday, February 02, 2004 10:45 AM
> > To: torque-user@db.apache.org
> > Subject: Torque Objects for multiple databases
> >
> >
> > When you compile some Torque objects for one database
> > platform.  Will they
> > work against a different database?  Or do you need to compile
> > them for each
> > type of database?  Any approachs on how to handle the
> > multiple different
> > types of database at run time versus compile time?
> >
> > ERic
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message