-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Filter collection by parent property
PostPosted: Wed May 18, 2011 12:23 pm 
Newbie

Joined: Tue Sep 07, 2010 9:12 am
Posts: 3
Hi, is it possible to use object property values with @Filter annotation?

For example, we have:

Child:
Code:
@Entity public class Child{
   @Column(name="id")
   public Integer id;

   @Column(name="surname")
   public String surname;
}


Parent:
Code:
@Entity public class Parent{
   @Column(name="id")
   public Integer id;

   @Column(name="surname")
   public String surname;

   @ManyToMany(fetch=FetchType.EAGER)
   @JoinTable(
      name="parents_children",
      joinColumns = @JoinColumn(name = "parent_id", referencedColumnName="id"),
      inverseJoinColumns = @JoinColumn(name = "children_id", referencedColumnName="id")
   )
   @Filter(name="propertyFilter", condition="children.surname = parent.surname")
   public List<Children> children;
}


What I try to accomplish is this line:
Code:
@Filter(name="propertyFilter", condition="children.surname = parent.surname")

I want to filter the collection, to leave only children with the same surname as parent.

How can I do this? Any other methods?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.