• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • 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
 
Travis Hein
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic