• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

using @Where with joins

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, in the end I will no use view. I am gonna just add an extra column to my place and tag table. I will have rewrite all the queries to include a statement like "AND state=my.package.State.ACTIVE" which is quite ugly and brings me an other question...

I don't know if I should create a new thread for this but, while I'm doing my refactoring, all my queries now looks like this

@Query("SELECT p FROM Place WHERE p.name=:name AND p.state=my.package.State.ACTIVE");
public List<Place> getPlaces();

I know that with Hibernate there is a way to put a "@Where (clause="state='ACTIVE?"); on the Entity (so i can remove that AND condition). This works well on simply query like the one above
But when I do join... it doesn't work like I would like. This is my Entity schema.

Now my question would be how can make this statement ONLY return the places and tags that are ACTIVE ?

Is this possible? Or will I have to write the query Explicitly ?

Thank you
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic