• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Allow extra join conditions to be specified in HQL join clauses -

 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following query where I want to add further restrictions to the join join clause. I am using the 'wtih' keyword as in written in the hibernate docs. However, I am always getting the following error a org.hibernate.hql.ast.QuerySyntaxError: unexpected token. If I take out 'with p.deleted is null' it works.

from Category as c
left join fetch c.member
left join fetch c.photos as p with p.deleted is null
where c.id = :categoryId
and c.member.id = :memberId

Does anyone know how to get this working?

thank you
david
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have something where i can try this, but can you put the with clause into the while clause?

from Category as c
left join fetch c.member
left join fetch c.photos as p
where c.id = :categoryId
and c.member.id = :memberId
and p.deleted is null

this sometimes works with (postgre)sql queries where i have more than one join.
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic