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: Criteria.setDbName() and BaseXXXPeer.setDbName()
Date Fri, 13 Apr 2007 10:02:48 GMT
Thomas Fischer wrote:

> private static void setDbName(Criteria crit)
> {
>     if (crit.getDbName() == Torque.getDefaultDB())
>     {
>         crit.setDbName(DATABASE_NAME);
>     }
> }
> 
> So because B (by chance) is the default database, BaseXXXPeer decides to
> replace "B" by its own database, "A", although I have told the criteria
> explicitly to use the database "B".

I'm not quite sure why this happens. The expression above clearly 
compares instances, not string values. So the expression should only 
evaluate to true if you set criteria.setDbName(Torque.getDefaultDB()); 
Any other string "B" should evaluate to false, because it is not the 
same string object. Can you confirm this?

(Generally I agree that this behaviour is highly mystic and should be 
changed.)

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