Hello,
I'm currently trying to build a native query for ORACLE that combines
several columns of different tables in a complex JOIN/UNION way including
some ORACLE specific things that do not allow me to redesign it for
JPA-native querys. However, I'm having trouble to understand how to handle
this kind of 'virtual' result set. I figured that I have to use an
@SqlResultSetMapping() somewhere on the resulting object.
My problems arise here, which lead to several questions:
If I design a Result-Object, how do I tell JPA that this shall be the
represence of a single row of the ResultSet? I can't use @Entity nor
@Table somehow, cause I always get error messages telling me that there is
no such table (which is correct)
What is the correct way of using SqlResultSetMapping for a simple result
with 12 columns that shall be mapped to 12 simple values in the resulting
'Entity'?
Does anybody have a good (maybe commented) example of such a
ResultSetMapping?
Where exactly do you put the SqlResultSetMapping? Do you annotate the
class that shall hold a row? Do I have to register that class in
persistence.xml?
My current solution always stucks with error messages like:
Invalid Index (Oracle Error)
the Message: Result path "{2}" in result type "{1}" of mapping "{0}"
attempts to map a field that does not have exactly 1 column. (I figured it
actually can't find a single column)
Table "{0}" given for "{1}" does not exist. (Happens when I try to use
@Entity on the resulting type)
Any help on these questions is gladly appreciated.
Thanks,
Heiko
If you are not the intended addressee, please inform us immediately that you
have received this e-mail in error, and delete it. We thank you for your
cooperation.