Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested properties is not working for addFilterIn and Collection of objects #71

Open
GoogleCodeExporter opened this issue Mar 21, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Helo,

Thanks for the very useful hibernate generic DAO, your code is.

I'm getting a little problem working on nested attributes and collection of 
mapped objects.

=== Classses ===
public class User implements Serializable {

    @Id
    private long id;

    @ManyToMany(fetch = LAZY)
    @JoinTable(
            name="user_group_user",
            schema="users",
            joinColumns = @JoinColumn(
                    name="userId", 
                    referencedColumnName = "id"), 
            inverseJoinColumns = @JoinColumn(
                    name="groupId", 
                    referencedColumnName = "id")
    )
    @OrderBy
    Set<UserGroup> groups;
}

public class ServiceRequest implements {

    @ManyToOne
    @JoinColumn(name="assignedUserId", referencedColumnName = "id")
    @Fetch(FetchMode.JOIN)
    private User assignedUser;
}
==================

This code is working fine:

Search s = new Search();        
List<Long> uids = new ArrayList<Long>();
uids.add(1l);
uids.add(2l);
s.addFilterIn("assignedUser.id", uids);

This code is not working

Search s = new Search();        
List<UserGroup> groups = new ArrayList<UserGroup>();
groups.add(new UserGroup(1));
groups.add(new UserGroup(2));
s.addFilterIn("assignedUser.groups", groups);

Error: 

Caused by: java.lang.IllegalArgumentException: Property path 
'assignedUser.groups' invalid for type com.sarbarian.itsm.entity.ServiceRequest
    at com.trg.search.jpa.JPAAnnotationMetadataUtil.get(JPAAnnotationMetadataUtil.java:24)
    at com.trg.search.BaseSearchProcessor.prepareValue(BaseSearchProcessor.java:707)
    at com.trg.search.BaseSearchProcessor.filterToQL(BaseSearchProcessor.java:451)
    at com.trg.search.BaseSearchProcessor.generateWhereClause(BaseSearchProcessor.java:413)
    at com.trg.search.BaseSearchProcessor.generateQL(BaseSearchProcessor.java:111)
    at com.trg.search.jpa.JPASearchProcessor.search(JPASearchProcessor.java:88)


Question: What should do I do?

Thanks !!

Davi.



Original issue reported on code.google.com by [email protected] on 8 Oct 2010 at 6:23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant