Florin Pop wrote:
Hi again,For me too!
I have tried your suggested approach but curiously the same result.
The tests that I run consist just in loading an Person object from the data source. Both with Hibernate and with OJB I use no cache and this load operation is the first and only one opperation that I execute in one session. So there is no object cached anywhere.
For me is also very surprizing the result.
How does your test looks like?
long time = System.currentTimeMillis(); Person person = (Person) broker.getObjectByQuery(query); time = System.currentTimeMillis() - time;
Can you post source of both test?
regards, Armin
Regards, Florin
PS: I have another question: is it possible in OJB to map an object field to a calculated value. For example I have a birthday column in PERSON table and I want to have in the Person class a field age containing the age of the person( age = currentDate - birthday, or something like this)
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 2:22 PM To: [EMAIL PROTECTED] Subject: RE: Loading an object
Hello,
-----Original Message----- From: Florin Pop [mailto:[EMAIL PROTECTED]
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:
I do not believe that.
[..]
Is there another way for doing this in OJB?
try:
Identity id = new Identity(Person.class, Person.class, new Long[] {new Long(PERSON_ID)});
PersistenceBroker.getObjectByIdentity(id);
Olli
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]