• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i have a filter collection?

 
avihai marchiano
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have a table A (A has a budget column) and table B (B has a price column �)

I also have Object A and Object B. I want that A will have a collection of B that their price is less than A.budget.

Can I do it with JPA?
Can I add or remove element from this collection?


Thank you
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain this in more detail. Some code, hibernate mappings or annotations?
 
avihai marchiano
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class Manager::
long budget
@OneToMany
Coolection<Book> booksCollection

Class Book::
long cost

I want that the booksCollection will contain only book that cost < manager.budget

Can i do this?
Kind of filter.

Thank you
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Filters are available from persistence providers (see, for example, Hibernate filters); I don't think they are standardized in the JPA, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic