File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JPA @NamedNativeQuery and scalar results Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "JPA @NamedNativeQuery and scalar results" Watch "JPA @NamedNativeQuery and scalar results" New topic
Author

JPA @NamedNativeQuery and scalar results

Brian Smith
Ranch Hand

Joined: May 20, 2005
Posts: 63
I am trying to use a @NamedNativeQuery which return an intersect query.

Here is the mapping I was trying



Eventhough this query returns all the columns of a single table, its treated as scalar because of the intersect operator. Here is the exception I got



How can I map this query to a entity? Will something like this work? Also how do I handle the foreign key that is mapped (in bold)? Do I need to map the related entity in the resultSetMapping as well? When this resultset it returned will the entities be managed? Or will I have to merge them?


Here is the entity definition



Thanks!
[ September 26, 2007: Message edited by: Brian Smith ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA @NamedNativeQuery and scalar results
 
Similar Threads
DeploymentException while deploying ear file in JBoss
No identifier specified for entity:
When starting JBOSS
Problem with DataSource
javax.naming.NameNotFoundException: XAConnectionFactory not bound