Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
    Bookmark Topic Watch Topic
  • New Topic

Can I join two tables in a NamedQuery?

 
Sheetal Tiwari
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

I have two tables that have one to one relationship and I have created java classes for both of them and annotated with @Entity.
Now for a particular case, I want to join both these tables and fetch the data.
Can tables be joined in @NamedQuery ?
Is yes , could you provide a sample.

If it cannot be done using @namedQuery then is it advisable to use @NamedNativeQuery in this scenario.

Thanks for the help.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!