You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Αντώνης Λεμπέσης <an...@di.uoa.gr> on 2005/02/04 21:05:38 UTC
use same conf with more than one databases
Hello,
In a quite large project we need to use a different database for each
developer. The schema is obviously the same for each one, but it turns
out that even if we change the torque.properties and build.properties
files, we still have to rebuild and compile everything because the
connection info is hardcoded into the autogenerated Base* classes.
Is there any way to get around this? After a while it has proven to be
really annoying...
Cheers,
Antonis.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: use same conf with more than one databases
Posted by Αντώνης Λεμπέσης <an...@di.uoa.gr>.
Guy Galil wrote:
>What's hardcoded in the base classes is a logical name that points to
>settings in Torque.properties - if you have each developer use a
>different properties file then they can access different databases.
>
>
I have tried to do this, but I got an exception (something about
torque.dsfactory...).
>Another alternative is to override the hardcoded database name by
>specifying a database name on each torque method call, all Torque
>methods such as save, doSelect, delete can be called with either a
>String database name or a connection object, off-course this might
>require massive code changes.
>
>
And besides that, we wouldn't be able to commit anything...
>The third alternative is to change configuration at run time, I have
>code that do this for Torque 3.02 that does not work with newer
>versions. The idea is to get the Configuration object, change some
>settings and reconfigure Torque.
>It requires some digging into the Torque code but is doable.
>I can provide the 3.02 code if you want but I know those things changed
>since that version.
>
>
I'de be grateful if you could send me that code. If I manage to get
something out of that, I'll let you know ;).
Thanks,
Antonis
PS. This i what I found in a Base*Peer file:
/** the default database name for this class */
public static final String DATABASE_NAME = "AdiasBase";
That's why I said that this info is hardcoded...
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: use same conf with more than one databases
Posted by Guy Galil <gu...@guardium.com>.
What's hardcoded in the base classes is a logical name that points to
settings in Torque.properties - if you have each developer use a
different properties file then they can access different databases.
Another alternative is to override the hardcoded database name by
specifying a database name on each torque method call, all Torque
methods such as save, doSelect, delete can be called with either a
String database name or a connection object, off-course this might
require massive code changes.
The third alternative is to change configuration at run time, I have
code that do this for Torque 3.02 that does not work with newer
versions. The idea is to get the Configuration object, change some
settings and reconfigure Torque.
It requires some digging into the Torque code but is doable.
I can provide the 3.02 code if you want but I know those things changed
since that version.
On Fri, 2005-02-04 at 15:05, Αντώνης Λεμπέσης wrote:
> Hello,
>
> In a quite large project we need to use a different database for each
> developer. The schema is obviously the same for each one, but it turns
> out that even if we change the torque.properties and build.properties
> files, we still have to rebuild and compile everything because the
> connection info is hardcoded into the autogenerated Base* classes.
>
> Is there any way to get around this? After a while it has proven to be
> really annoying...
>
> Cheers,
> Antonis.
>
>
> ---------------------------------------------------------------------
> 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
Re: use same conf with more than one databases
Posted by Alvaro Coronel <al...@yahoo.com>.
Look at this couple of lines from my Torque.properties
torque.dsfactory.consolidada.connection.url = jdbc:mysql://192.168.1.55:3306/consolidada
# torque.dsfactory.consolidada.connection.url = jdbc:mysql://localhost:3306/consolidada
# torque.dsfactory.consolidada.connection.url = jdbc:mysql://localhost:3306/cons_test
I comment and uncomment and point to different databases without regenerating. It works fine.
Good luck!
�lvaro
������� �������� <an...@di.uoa.gr> wrote:
Hello,
In a quite large project we need to use a different database for each
developer. The schema is obviously the same for each one, but it turns
out that even if we change the torque.properties and build.properties
files, we still have to rebuild and compile everything because the
connection info is hardcoded into the autogenerated Base* classes.
Is there any way to get around this? After a while it has proven to be
really annoying...
Cheers,
Antonis.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'