Hi Bob, You can obtain a PersistenceBroker instance from the ODMG transaction by casting it to the interface HasBroker and then use OJB queries. The only difference is that you have to read-lock the query results yourself:
PersistenceBroker pb = ((HasBroker) tx).getBroker(); Object result = broker.getObjectByQuery(query); tx.lock(result,Transaction.READ); Cheers, Gerard On Wed, 29 Oct 2003 14:45:52 -0500, "Robert J Celestino" <[EMAIL PROTECTED]> wrote: >Hello All, > >I would like to tuse ODMG API, but I am not crazy about the pseudo sql style of the >OQLQuery. I think that the persistence broker queries are much cleaner and more >object oriented. > >Is it possible to create an OQLQuery or EnhancedOQLQuery using the Criteria class or >something similar? > >For example instead of OQL style: > EnhancedOQLQuery query1 = _omdg.newOQLQuery(); > String q = "select p from " + Person.class.getName() + " where Id = " + > queryId ; > query1.create( q ) ; > >This PersistenceBroker style: > Criteria crit = new Criteria() ; > crit.addEqualTo( "Id", id ) ; > Query query2 = QueryFactory.newQuery( Person.class, crit ) ; > > >Thanks! > >---------------------------------------------------------------- >Bob Celestino >SAS Research and Development >919 - 531 - 9425 >[EMAIL PROTECTED] > >SAS - The Power to Know --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
