Search code examples
playframeworkplayframework-1.x

Play framework find list by list


I use Play framework 1.2.7.

Lets say I have three models, Picture and Feed, which both have a @ManyToMany connection to Tag. Now in the Feed model I'd like to add two methods:

  • get all Pictures where all tags from Feed.tags exists in Picture.tags (if Picture has additional tags that's still OK).
  • get all Pictures where at least one tag from Feed.tags exists in Picture.tags

I know this can be done in code, but if possible I'd like to do it in a statement. Anyone got any idea how to do this?


Solution

  • In my knowledge, we CANNOT do it in just 1 query statement, you should implement in other way.

    But, shortest way is using Criteria class with Query class to provide a statement with AND/OR operator.