Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Theta-style joins in Criteria

 
John Bartlett
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am convering all my queries to Criteria but have come across a query that includes a Theta-style join. The book i have been using says these are currently not available within the criteria API, is this true?

I have been searching for a while and have not come up with anything to disprove this, was wondering whether anyone had found a way around this?

Thank you,

John
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well Theta style joins are just where the relationship of keys is typed in the Where clause, and does not necessarily use PKs and FKs.

The Criteria object starts with just one object type, then to add a join, you use addAlias(), so the "Join" statement is created by Hibernate, so you never get to do a theta style join. That is why they aren't supported, because you can't just add a table to the From clause, and add Where clauses to the two tables. Does that make sense?

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic