The schema databasemap name (e.g. defaultDB) will always be hard coded to the
name in the XML file. So, it will never be found in another Database object.
Your code snippet doesn't connect the nondefaultDB pool name to anything
the criteria/SQLBuilder uses. But your debugging showed it was looking for
this name. I suspect this is because your runtime torque.database.default
property set to nondefaultDB.
This property is the name that Torque uses for the default if none is
specified.
Try either changing your runtime settings to use defaultDB or specify the
defaultDB name on your criteria constructor, e.g. new Criteria(defaultDB).
This will make sure that the name used will match the schema name.
-Original Message-
From: Sheldon Ross [mailto:sr...@simmgene.com]
Sent: Monday, November 16, 2009 5:19 PM
To: Apache Torque Users List
Subject: Re: Criteria needs write permissions?
Second, create all criteria element using the *Peer objects. The
DatabaseMap is populated when a *Peer class is loaded (static init).
So, all tables Maps you will be referencing will exist in a Database
object keyed to the DB Schema Name.
This seems to be where I'm failing. Yes some queries will work. But I
don't think
the metadata areas will work. If this is what you meant, then I
apologize.
For example. Use an OrderBy clause for selecting from a database
connection pool
that is not from the default schema for that object.
Connection srcConn = Torque.getConnection(nondefaultDB);
Criteria critera = new Criteria();
criteria.addAscendingOrderByColumn(TableAPeer.COLA);
TableAPeer.doSelect(criteria,srcConn);
This doesn't work for me because TableA does not exist in the dbMap
for nondefaultDB. It does exist in the dbMap for defaultDB because
that's
what's coded via the schema name.
SQLBuilder succeeds at building the query for
c.add(TableAPeer.COLA, 4);
because it doesn't reference any metadata.
It fails on the processOrderBy(db, dbMap, crit, query);
because this function assumes the metadata is there.
Ross
DukeCE 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: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org