I have a problem using OCM query manager on a bean field.
I have the following two simple class:
@Node(jcrType = "nt:unstructured" )
public class User{
@Field(id=true, jcrMandatory=true)
private String email;
@Bean(converter = ReferenceBeanConverterImpl.class)
private UserProfile userProfile;
...
}
@Node(jcrType = "nt:unstructured")
public class UserProfile{
@Field(path = true)
private String path;
...
}
And the following method, where the important part is on the line:
filter.addEqualTo("userProfile", profile);
public List<User> getByProfile(UserProfile profile){
QueryManager queryManager =
getJcrMappingtemplate().createQueryManager();
Filter filter = queryManager.createFilter(getPersistentClass());
filter.setScope("//");
filter.addEqualTo("userProfile", profile);
Query query = queryManager.createQuery(filter);
return new ArrayList<User>(getJcrMappingtemplate().getObjects(query));
}
The method throws an error because the Filter can't create the JCR
query for the Bean/Value of profile.
Maybe I missed some mandatory info on the beans.
I searched on the Junit test of OCM, but without success.
Is correct this approch to OCM?
Thanks in advance,
Alessandro
--
Alessandro Vincelli
---
http://www.alessandro.vincelli.name
http://devel.alessandro.vincelli.name