Hi Florin,

Florin Pop wrote:
Hi *,

which is the recomended way of loading ann object from the repository when
the primary key is known.
 I tried:

        Criteria crit = new Criteria();
        crit.addEqualTo("id", new Long(PERSON_ID));
        Query query = new QueryByCriteria(Person.class, crit);
        Person person = (Person) broker.getObjectByQuery(query);

but it works very slow, 6-8 times slower than in Hibernate: Person person = (Person) session.load(Person.class, new
Long(PERSON_ID));


You can't compare these methods

getObjectByQuery does at all event perform an sql query
and then analyse ResultSet if object needs materialization
or could be found in cache

session.load(Person.class, new Long(PERSON_ID));
does first look in the cache for an object with
given UID and if not found perform an DB lookup

A similar method in PB-api is
getObjectByIdentity(Identity id)

regards,
Armin


Is there another way for doing this in OJB?

Thanks,

Florin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to