One thing to keep in mind as you're modifying this is the long term request/idea of separating out the Torque "schema" name function that DBName does from the DB connection function.
I.e., you should be able to compile the OM once and use this with multiple connections. For example, doing some sort of copy between DB servers or an app with different users accessing their own database area. Probably beyond the scope of what you're playing with but if you see an easy way to do this... If I remember right, a big problem in this is that there are a lot of areas where objects are created without access to criteria / connection info. These are the problem area, since it defaults to the compiled DB connection info. > -----Original Message----- > From: Thomas Fischer [mailto:[EMAIL PROTECTED] > Sent: Friday, April 13, 2007 6:34 AM > To: Apache Torque Developers List > Subject: Re: Criteria.setDbName() and BaseXXXPeer.setDbName() > > Thomas Vandahl <[EMAIL PROTECTED]> schrieb am > 13.04.2007 12:02:48: > > > 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". > > > Sorry, the example code I used in testing was not the one I > used in the email. I used > Criteria.setDbName(Torque.getDefaultDb()) and thought I > should clarify this by writing "B" instead, but this leads to > different results :-(. Thanks for noting. > But this does not change the point that I explicitly stated > in the code that the Default DB should be used and it does > not get used. > > > (Generally I agree that this behaviour is highly mystic and > should be > > changed.) > > Do you think it should be changed in RC3 ? > > Thomas > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Duke CE Privacy Statement Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
