fan wrote:
Tank you kjordan2001
I looked at the filters, but either I don't get something or they do not suit my needs.
I don't want to return the orders, I want to return the Partners. But within the partners I only want the Orders sub collection, which have the "open" state.
Filters for what I understand give you another way to write a where clause. I.e. you reduce the size of your collection. In my case the collection I could reduce is the Partner collection, not the Order collection within the Partners :(
The only way I see for now is building a DTO, but I will have to iterate over all my order collection to define if they are in the "open" state (either by hand or via filter)
That's what filters do, if you look at:
Code:
@OneToMany
@JoinTable
//filter on the target entity table
@Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length")
//filter on the association table
@FilterJoinTable(name="security", condition=":userlevel >= requredLevel")
public Set<Forest> getForests() { ... }