Your "template" likely refers to an instance with the default value for the primary key field, which is 0, and there is no record with PK equal to zero in your database.

Pulat

Annapoorani Rathi wrote:
Hi,
I just started on OJB..
In PB Tutorial, the code snippet does not fetch me the record and result is null (though the record is present in DB)
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
QueryByCriteria query = new QueryByCriteria(template);
result = (Product)broker.getObjectByQuery(query);
But if i replace the above with the code below, i do get a populated result object


broker = PersistenceBrokerFactory.defaultPersistenceBroker();
Criteria criteria = new Criteria();
criteria.addEqualTo("name","Sprocket");
QueryByCriteria query = new QueryByCriteria(Product.class, criteria);
result = (Product)broker.getObjectByQuery(query);
I understand that the first Impl decodes to Second internally.
But then the first Impl does not work.


Can anyone help me to reason out?? Thanks
Anna








---------------------------------
  Yahoo! Messenger - Communicate instantly..."Ping" your friends today! 
Download Messenger Now


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



Reply via email to