File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes JPA: Joins with unmapped tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA: Joins with unmapped tables" Watch "JPA: Joins with unmapped tables" New topic

JPA: Joins with unmapped tables

Uwe Schäfer
Ranch Hand

Joined: Mar 15, 2005
Posts: 52

is it possible with jpql (hibernate here) to join to an unmapped table ?
i need to retrieve entities, that match some criteria with an unmapped table (ids, here). yes i know, i can use native queries, but in that case i´d have to create all the other joins myself (which is what the JPA normally does for me).

an example:

jpql query:

what i need would be something liek that:
or even something like

creating an bogus Entity for that unmapped table works, but isn´t an option (because i would load tons of data from there, which i do not need)

cu uwe

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

No is the short answer. JPQL only works with ampped entities.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: JPA: Joins with unmapped tables
It's not a secret anymore!