db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ekkehard Kraemer <ekrae...@pluto.camelot.de>
Subject Torque with more dynamic DB connections, avoiding singleton and statics?
Date Wed, 31 Dec 2003 11:48:28 GMT
Hello,

is it possible to avoid the Torque singleton and static OM members altogether?

I have some quite dynamic needs for my DBMS connections. In the easiest case, it boils down
to being able to specify which of several databases (defined in the standard Torque property
file) to use during runtime.

Ideally, I would do something like

         for (Iterator i=SomePeer.doSelect(whichDb,crit).iterator();
              i.hasNext(); )
         {
             Some some=(Some)(i.next()); // some is from whichDb
             doSomething(some);
         }

Or

         TorqueInstance torq=new TorqueInstance(whichDb);
         for (Iterator i=SomePeer.doSelect(torq,crit).iterator();
              i.hasNext(); )
         ...

Or

         SomePeer somePeer=new SomePeer(whichDb);
         for (Iterator i=somePeer.doSelect(torq,crit).iterator();
              i.hasNext(); )
         ...


Where whichDb tells Torque which database should be used.

While a TorqueInstance exists already, the generated OM classes contain static members for
the database name (and maybe other things). I see no place to put the "whichDb" in.

Any hint on whether this can be solved, and how? I didn't find much in the documentation or
the archives; and looking at the source code made me suspect it is not possible at the moment.
Am I wrong? Is this functionality being planned for the future of Torque?

Simply changing the "final static" members to "static" and overwriting them as needed is probably
not a solution for me, as the next step would be to work on two different databases at the
same time (with the same set of OM classes)...

Thanks in advance,
Ekkehard

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