db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mehmet Erdem <mehmet.er...@rwth-aachen.de>
Subject How to make the default database settable during runtime?
Date Wed, 18 Apr 2007 15:40:18 GMT
Hi,

I am using Torque 3.2 and I try to make the default database settable 
during runtime.

I created a class DefaultDatabase with a static method getName() that 
takes the default
database name from a property file.

Then I modified the MapBuilder.vm and Peer.vm to refer to this getName() 
method instead of the template variable $table.Database.Name.

MapBuilder.vm:

<       dbMap = Torque.getDatabaseMap(DefaultDatabase.getName());
---
 >       dbMap = Torque.getDatabaseMap("$table.Database.Name");


Peer.vm:

<     public static final String DATABASE_NAME = DefaultDatabase.getName();
<
---
 >     public static final String DATABASE_NAME = "$table.Database.Name";
 >


So is this the right way to make the default database settable. Or did I 
miss something ? It seems
unlikely that I am the only one so far who wants to change the database 
without regenerating
classes.

Thanks,

Mehmet Erdem


---------------------------------------------------------------------
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