I have created the node and created 3 versions.
String path = "/my111";
MyClass m1 = new MyClass();
m1.setPath(path);
m1.setName("Myname");
m1.setLanguage("English");
ocm.create(m1);
ocm.save();
for (int i = 0; i < 4; i++) {
ocm.checkout(path);
m1.setName("mz676666" + i);
ocm.update(m1);
ocm.save();
ocm.checkin(path);
}
VersionIterator iterator = ocm.getAllVersions(path);
while (iterator.hasNext()) {
Version version = (Version)iterator.next();
System.out.println("version::"+version.getName());
}
Output :
version::jcr:rootVersion
version::1.0
version::1.1
version::1.2
version::1.3
Now i want to get the name
of a version 1.2
..
I tried it through
org.apache.jackrabbit.ocm.version.VersionIterator iterator = ocm.getAllVersions(path);
while (iterator.hasNext()) {
Version version = (Version)iterator.next();
System.out.println("version::"+version.getName());
MyClass m1 = (MyClass) ocm.getObject(path, version.getName());
System.out.println(m1.getName()); // But it always print `null`. Why??
}
Can it is possible to fire query and fetch the data?
How i can achieve this?
Please answer this.
Thanks in advance.