On 11/13/01 9:13 AM, "Weaver, Scott" <[EMAIL PROTECTED]> wrote:

> Got a question ;)
> 
> Why does the doBuild() method in all of the Torque-generated peers have the
> database map hard coded?
> 
> dbMap = TurbineDB.getDatabaseMap("jstore");
>
> The reason I bring this up is because I had changed a couple of things
> around when I was building my app where this caused me problems.  I had a
> project name of "store", but I wanted the database to be called "jstore."
> So, after running the first ant to create the project in the webapp
> directory, I went into build.properties and changed both the
> Turbine-schema.xml and store-schema.xml from <database name="store"> to
> <database name="jstore">.  I also changed the idTableDatabase from
> "idTableDatabase = store" to "idTableDatabase = jstore" then ran "ant init"
> which created these entries in my turbine.properties
> 
> database.store.driver=org.gjt.mm.mysql.Driver
> database.store.url=jdbc:mysql://127.0.0.1/jstore
> database.store.username=-----
> database.store.password=-----
> 
> 
> services.PoolBrokerService.defaultPool = store
> services.MapBrokerService.defaultMap = store
> 
> But all the map classes had the line:
> 
> dbMap = TurbineDB.getDatabaseMap("jstore");
> 
> in the doBuild() method which was causing all off my peers to fail with a
> "connection is null!" exception.
> 
> After changing all references to "store" to "jstore" in the above lines in
> turbine.properties everything worked fine.
> 
> My point is, why not grab the value for the default map from
> turbine.properties like this:
> 
> dbMap =
> TurbineDB.getDatabaseMap(TurbineResources.getString("services.MapBrokerServi
> ce.defaultMap"));
> 
> Would this not make things a little more flexible and less prone to error
> (IMOHO hard-coding is not the best approach)? Am I think correctly here or
> is my logic totally off base.

Actually John and I talked about this the other day and we're trying to make
it more flexible in the face of multiple databases too. You are also dealing
with the TDKs specific way of doing things which needs to be made more
flexible. Everything is keyed off the project name which is fairly
restrictive, this will change in the next TDK.

Configuration in general will also be simpler in the decoupled torque.

> Regards,
> Scott
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to