If I have understood correctly, this PersistentFieldDefaultImpl uses java
bean introspection
to determine the accessors and mutators.
Here are steps I did:
My persistable Test object contains following properties :
            int id;
            int age;
            int height;
Here is the snap shot of my Test table in DB:
        id       age     height
        1        12      134
        2        17      166
        3        22      190
My OJB.properties: I am using
PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentFi
eldPropertyImpl

I would like to retrieve obj with id = 2, so I wrote following code :
    Test example = new Test();
    example.setId(2);
    Query query = new QueryByCriteria(example);
    broker.beginTransaction();
    Test toBeEdited = (Test) broker.getObjectByQuery(query);
And I am getting NULL.<<<huh>>>
If I change the DB Table with
        id       age     height
        1        12      134
        2        0      0
        3        22      190
I am getting/able to retrieve the obj with id = 2.

I have realized that broker.getObjectByQuery() is issueing SQL
as SELECT * FROM TEST WHERE ID=2 & AGE=0 & HEIGHT=0;
[ please note, in the code, I have only set the ID similar to the TUTORIAL 1
update Product code ]

Where as I am expecting SQL like
SELECT * FROM TEST WHERE ID=2;
[ since I have only set the ID and NOTHING else]

Am I expecting something wrong ?
Or this is a OJB bug in  PersistentFieldDefaultImpl  code.

thanks
aj


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

Reply via email to