Ok, thanks for clarifying that. Here's a scenario:
I generate the OM classes with a database name of "foo". Then I change the database name everywhere to "bar". When I run what will happen? I suspect it will try to look for the "foo" database and find nothing. This is what I found so grievous. Am I wrong? Thanks, Andrew -----Original Message----- From: Howard Lin [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 5:22 PM To: Turbine Torque Users List Subject: RE: Why is the database name hardcoded EVERYWHERE? The database name is NOT actually the real database name. It's just a handle (or a key) used by Torque Peer object to access the runtime connection to the table set defined in the XML file. The real database name is normally specified in url. For example, in XML file, your have <database name="anything"> (If you don't specify a name, Torque will use "default"), so in run-time property file, you define torque.database.anything.url etc. When Torque starts, it reads and saves all connection information about this "anything" database. When a query is made, the Peer object will get connection information through this key. Howard Lin > -----Original Message----- > From: Andrew [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 06, 2002 3:21 PM > To: Torque Users List (E-mail) > Subject: RE: Why is the database name hardcoded EVERYWHERE? > > > Well, it's apparent you've never looked at the code Torque > generates for > you, because every reference to the database name is hardcoded in the > BaseXXXPeer classes. > > /** the default database name for this class */ > public static final String DATABASE_NAME = "databaseName"; > > This is what seems grievous to me because it means you have > to recompile > just to change the database name. To me, this seems to go > against the nature > of Torque. > > However, given what I learned from another post it *might* > make sense if you > are using multiple database in your schema because then > you're probably > using the save(String) method and not save() to specify your database. > Though I do disagree with this, if this is the proper use. > Generated OM > classes should know what DBs they belong to so why would you > need to specify > the db to save it to? Perhaps its just a case of incomplete > documentation. > > For my personal use I've changed the velocity templates so > that in place of > the hardcoded db name it makes a call to torque to find out > what it is based > on the runtime properties file. Another thing that seems > funny to me is that > none of the other db parameters seem to be hardcoded: url, > driver, user, > pass, etc. Why should db name be singled out? > > Just a a confused lover of Torque, > Andrew > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Daniel Rall > Sent: Thursday, June 06, 2002 2:09 PM > To: Turbine Torque Developers List > Cc: [EMAIL PROTECTED] > Subject: Re: Why is the database name hardcoded EVERYWHERE? > > > "Andrew" <[EMAIL PROTECTED]> writes: > > > Hi all, > > > > I was wondering what the logic of having the database name > be hardcoded > is? > > This seems to me to make runtime changes and deployment > impossible without > > recompiling. Why doesn't it just refer to what was passed > in through the > > configuration file? > > What the hell are you talking about? This sort of comment is not > useful; please cite a list of file names and line numbers from CVS > HEAD. > > > Thanks, Dan > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
<<attachment: winmail.dat>>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
