jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Vincelli <a.vince...@gmail.com>
Subject OCM query on bean field
Date Sun, 17 May 2009 19:43:35 GMT
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 =
        Filter filter = queryManager.createFilter(getPersistentClass());
        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 Vincelli

View raw message