Hi again,

it's possible to search an object by the value of an attribute thought the version history? Ok, let me to better explain it; I have an object like this (correctly mapped in a xml descriptor and defined (CND) - it has the "mix:versionable" type too):

public class MyObject {
   private String path;
   private String foo;
   // other attributes, getters and setters follows ...
}

I wish to check in many versions of this object differing for the value of "foo" attribute (ie: "bar", "dummy", "lazy", etc...) and then I hope to retrieve one of them searching for it's "foo" value.
Example:

MyObject myobject = new MyObject();
myobject.setPath("/itsme");
myobject.setFoo("bar");
ocm.insert(myobject);
...
myobject.setFoo("dummy");
ocm.checkout("/itsme");
ocm.update(myobject);
ocm.checkin(myobject);
...
myobject.setFoo("lazy");
ocm.checkout("/itsme");
ocm.update(myobject);
ocm.checkin(myobject);
...

Filter f1 = qm.createFilter(MyObject.class);
f1.addEqualTo("foo", "lazy");
MyObject o = (MyObject) ocm.getObject(qm.createQuery(f1)); // This works!
...
Filter f2 = qm.createFilter(MyObject.class);
f2.addEqualTo("foo", "bar");
MyObject o = (MyObject) ocm.getObject(qm.createQuery(f2)); // This returns "null" :(
...

I hope someone helps me.
Thank you,
--
GaS

Reply via email to