• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement this method using Criteria ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
In my application domain objects,the relationship between Author and book is many to many.
My author class has a method called findAuthorsByBookCriteria.
Well, I want to implement this methos using Criteria interface but I'm unsure about its implementation.
If my Author class has a Book instance variable, then it is easy to write, but Author class has a List of Books (List books = new ArrayList( )).
Any help ?
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a few ways to do this. I think the easiest is to use Restrictions.in().

Something like this:



See the Hibernate docs and API for more info.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic