Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join tables from different schema in jpa

 
sangeetha krishnamurthi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using ejb3 amd i want to join two tables which are present in different schemas.how to do that in jpa.let me know some sites where i can find some examples for join.

Regards,
Sangeetha
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure about its use in JPA, but it can be done in general by fully qualifying the schema.table in queries. It will only work if the user has access to all schemas. It's not a good idea though, and the only time I have needed to do it, we found it easier to import the table temporarily, run the queries and drop the table.
 
sangeetha krishnamurthi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi david,

i tried the same way you said i was able to execute that query in oracle but while mapping to my entity i am wrong somewhere. could you provide me a example for joining two tables with object relational mapping.

thanks
sangeetha
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I mean about its usage in JPA - I'm not sure it is supported.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It isn't supported, so to speak. You can always create an SQLQuery instead of hoping for any mapping solution.

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