db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl <thomas.vand...@tewisoft.de>
Subject Re: svn commit: r571790 - in /db/torque/runtime/trunk/src/java/org/apache/torque: TorqueInstance.java manager/AbstractBaseManager.java
Date Fri, 07 Sep 2007 11:54:15 GMT
Thomas Fischer wrote:
>>"default" has always
>>been a reserved name for a database, the whole feature
>>torque.database.default would not make sense otherwise.
> 
> 
> Here I do not agree. _Because_ this configuration parameter exists, the
> standard name "default" does not make sense. If one wishes the default
> database's name to be "default", then it can be done by
> torque.database.default=default

It's obviously difficult to make myself clear. This very Torque feature 
is documented and works so that the meaning of the database/datasource 
"default" can be routed to one of the existing database definitions. Why 
doesn't that make sense? I'll try an example.

---8<---
torque.database.turbine.adapter=mysql
torque.dsfactory.turbine.factory=org.apache.torque.dsfactory.JndiDataSourceFactory 

torque.dsfactory.turbine.jndi.path=java:/comp/env/jdbc/Turbine
torque.dsfactory.turbine.jndi.ttl=300000

torque.database.myapp.adapter=mysql
torque.dsfactory.myapp.factory=org.apache.torque.dsfactory.JndiDataSourceFactory
torque.dsfactory.myapp.jndi.path=java:/comp/env/jdbc/MyApp
torque.dsfactory.myapp.jndi.ttl=300000
---8<---

If I now generate OM classes for the database name "default", I can 
decide - via configuration - which of the two database definitions to 
use by simply setting

torque.database.default=turbine

or

torque.database.default=myapp

How would I achieve this without the feature discussed?

> In this section, it says if you do not set the "name" attribute in the
> schema.xml, the generator will set it to be "default". It does not say
> anything about references during runtime.

It does.
---8<---
As Torque has the ability to use multiple databases you can tell it 
which one to use by default thus...

torque.database.default=bookstore
---8<---

It doesn't matter if the name of that default database is a reference 
internally. The intention was to give the user a choice and I second 
that intention.

> In my eyes, all boils down to
> "Can we ask the turbine users to configure the database "default" in their
> Torque.properties or not ?"

Where would this database point to? In my JNDI example above I would 
still use the same connection pool but with other factories I would open 
a second one when it is not exactly necessary. You might not need this 
feature. I do. So what's wrong with it?

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message