• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

using @Where with joins

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic