I did a lot more detailed debugging and stepping thru the code.
I have discovered that in the following method (found in the generated
BaseInvoiceHeaderPeer class) when the criteria object is created, by
default it will look to the default database defined in
Torque.properties.
When I changed the highlight line to read "new Criteria(DATABASE_NAME)",
then my database inserts work correctly.
I see that other methods (like doUpdate) already have this correctly
generated, so I am assuming that the code that generates the Base..Peer
classes has a bug in it.
public static Criteria buildCriteria( InvoiceHeader obj )
{
---modified---> Criteria criteria = new Criteria(DATABASE_NAME);
if ( !obj.isNew() )
criteria.add( ID, obj.getId() );
criteria.add( NAME, obj.getName() );
return criteria;
}
-----Original Message-----
From: Pete Kazmier [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 7:52 AM
To: Turbine Users List
Subject: Re: FW: Error using Multiple Databases and Torque
I'm also a bit confused as to the torque.database.default property
semantics. Even when using a single database, if I have the following
properties:
torque.database.default=bookstore
torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
torque.database.bookstore.url = jdbc:mysql://127.0.0.1/bookstore
torque.database.bookstore.username = username
torque.database.bookstore.password = password
Everything works great. But, if I use the following:
torque.database.default=somethingelse
torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
torque.database.bookstore.url = jdbc:mysql://127.0.0.1/bookstore
torque.database.bookstore.username = username
torque.database.bookstore.password = password
I get NPEs. My schema (and id-table-schema) explicitly uses "bookstore"
as the name of the database. What exactly is this default property used
for? I've been meaning to go through the code for a definitive answer,
I just haven't gotten around to it yet, any insight would be helpful for
the tutorial that I am writing.
Thanks,
Pete
On Sun, Feb 03, 2002 at 08:47:36PM -0600, Dave Everson wrote:
> I wanted to add one more observation before sending this.
>
> We also noticed that when we change torque.database.default property,
we
> are not able to insert into that database that is NOT set by this
> property. For example, if we set this property to rcmwf we can't
insert
> into smartdata. If we set this property to smartdata, we can't insert
> into rcmwf.
>
> Dave
>
> -----Original Message-----
> From: Dave Everson [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 03, 2002 8:41 PM
> To: 'Turbine Users List'
> Subject: Error using Multiple Databases and Torque
>
> We are using the OM classes generated via standalone Torque (built
from
> CVS Jan29th). We have two schemas that point to two databases (rcmwf
> and smartdata). In testing our code we have discovered that we are
able
> to read and insert/update data in the first database (rcmwf).
However,
> with the second database (smartdata) we can only read data. Whenever
we
> attempt to perform an insert with the second database, we get a Null
> Pointer Exception. Unfortunately we don't get any more information
than
> this. Attached is a portion of the Torque.properties configuration
file.
>
>
> Does anybody know what might be causing these exceptions?
>
>
> Portion of the .properties file:
>
> torque.database.default=rcmwf
>
> torque.database.rcmwf.driver=org.gjt.mm.mysql.Driver
> torque.database.rcmwf.url=jdbc:mysql://localhost:3306/rcmwf
> torque.database.rcmwf.username=
> torque.database.rcmwf.password=
>
> torque.database.smartclaim.driver=org.gjt.mm.mysql.Driver
> torque.database.smartclaim.url=jdbc:mysql://localhost:3306/smartdata
> torque.database.smartclaim.username=
> torque.database.smartclaim.password=
>
> # The number of database connections to cache per ConnectionPool
> # instance (specified per database).
>
> torque.database.rcmwf.maxConnections=80
> torque.database.smartclaim.maxConnections=80
>
> # The amount of time (in milliseconds) that database connections will
be
> # cached (specified per database).
> #
> # Default: one hour = 60 * 60 * 1000
>
> torque.database.rcmwf.expiryTime=3600000
> torque.database.smartclaim.expiryTime=3600000
>
> # The amount of time (in milliseconds) a connection request will have
to
> wait
> # before a time out occurs and an error is thrown.
> #
> # Default: ten seconds = 10 * 1000
>
> torque.database.rcmwf.connectionWaitTimeout=10000
> torque.database.smartclaim.connectionWaitTimeout=10000
>
> # The interval (in milliseconds) between which the PoolBrokerService
> logs
> # the status of it's ConnectionPools.
> #
> # Default: No logging = 0 = 0 * 1000
>
> torque.database.logInterval=10
>
>
>
>
> --
> 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]>
>
--
Peter Kazmier http://www.kazmier.com
PGP Fingerprint 4FE7 8DA3 D0B5 9CAA 69DC 7243 1855 BC2E 4B43 5654
--
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]>