Exactly the same with ojb queries... It will still search the
ojbconcreteclass column even if the table/repository.xml/class don't need
it.
PersistenceBroker broker = ((HasBroker) transaction).getBroker();
broker.beginTransaction();
// ask the broker to perfom the query.
// the concrete result type is configurable
Query query = QueryFactory.newQuery(Resource.class, new Criteria());
ManageableCollection result =
(ManageableCollection) broker.getCollectionByQuery(query);
broker.commitTransaction();
// read-lock all resulting objects to the current transaction
Iterator iter = result.ojbIterator();
Object toBeLocked = null;
while (iter.hasNext())
{
toBeLocked = iter.next();
//we can only lock objects, not attributes
if (broker.hasClassDescriptor(toBeLocked.getClass()))
transaction.lock(toBeLocked, Transaction.READ);
if(toBeLocked instanceof Resource){
System.out.println(((Resource)toBeLocked).toXML());
}
else{
System.out.println(toBeLocked);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]