• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA2 CriteriaBuilder join question

 
felagund finrod
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys,

how can i code the sql below using JPA2 CriteriaBuilder?



i tried to use SetJoin but couldn't figure how to use.

thanks in advance
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you have a parent/children relationship, then just join by this relationship. If you don't, then you should add one. If for some odd reason you didn't want a relationship you could get a root on both object and join them manually in the where clause.

See,
http://en.wikibooks.org/wiki/Java_Persistence/Querying#Joining.2C_querying_on_a_OneToMany_relationship
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic