Hi Arne,
excuse my late answer, I've been away for awhile.
But now, back in full swing, I'd like to
thank you a lot for your suggestion,
it works perfectly for me!!!!
I get this stack trace and a resonable exception:
Caused by: java.sql.SQLException: ORA-00054: Versuch, mit NOWAIT eine bereits belegte
Ressource anzufordern.
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1819)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2015)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:571)
at com.workingdogs.village.QueryDataSet.<init>(QueryDataSet.java:113)
at org.apache.torque.util.BasePeer.executeQuery(BasePeer.java:1539)
man, that's just great.
of course, I need to carefully choose which doselect to use in order
not to open long transactions myself,
and I might need to adjust the save() method to,
but so far I'm done.
Is the nowait option ANSI compliant or is it oracle specific?
Best regards,
Tino
-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 9. September 2004 16:16
An: Apache Torque Users List
Betreff: Antwort: AW: Antwort: blocking calls, query timeout
Hi Tino,
good question . . .
One would like to be able to override the createQueryString method of the
XxxPeer class, but - alas! - it is a static method :-(
The only solution I see is implement some additional methods in your
XxxPeer class that do everything that's already in the BaseXxxPeer class,
but with the modified select statement (please note that I have appended
"ForUpdateNowait" to the method names):
public static Xxx retrieveByPKForUpdateNowait(ObjectKey pk, Connection
con)
throws TorqueException, NoRowsException, TooManyRowsException
{
Criteria criteria = buildCriteria(pk);
List v = doSelectForUpdateNowait(criteria, con);
if (v.size() == 0)
{
throw new NoRowsException("Failed to select a row.");
}
else if (v.size() > 1)
{
throw new TooManyRowsException("Failed to select only one
row.");
}
else
{
return (Xxx)v.get(0);
}
}
public static List doSelectForUpdateNowait(Criteria criteria,
Connection con)
throws TorqueException
{
return
populateObjects(doSelectForUpdateNowaitVillageRecords(criteria, con));
}
public static List doSelectForUpdateNowaitVillageRecords(Criteria
criteria, Connection con)
throws TorqueException
{
if (criteria.getSelectColumns().size() == 0)
{
addSelectColumns(criteria);
}
// Set the correct dbName if it has not been overridden
// criteria.getDbName will return the same object if not set to
// another value so == check is okay and faster
if (criteria.getDbName() == Torque.getDefaultDB())
{
criteria.setDbName(DATABASE_NAME);
}
// BasePeer returns a List of Value (Village) arrays. The array
// order follows the order columns were placed in the Select
clause.
// if (con == null)
// {
// return BasePeer.doSelect(criteria);
// }
// else
// {
// return BasePeer.doSelect(criteria, con);
// }
return BasePeer.executeQuery(
createQueryString(criteria) + " FOR UPDATE NOWAIT",
criteria.getOffset(),
criteria.getLimit(),
criteria.isSingleRecord(),
con);
}
Please note that this code presumes you have a non-null Connection con when
invoking retrieveByPKForUpdateNowait.
I have not tested if this code actually works, but perhaps you've got the
time to do this and report your experience back...
Gruss
Arne
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]