|
|
Re: [Teneo] Teneo Mapping XML file and Named Native Queries [message #1098046 is a reply to message #1097593] |
Fri, 30 August 2013 14:28 |
juan velez Messages: 10 Registered: June 2013 |
Junior Member |
|
|
Hi Martin,
Yes, I will enter a bugzilla for it. Unfortunate I cannot use the named-query since this is the annotation used for HQL named queries, hence the need for the named-native-query as you pointed it out.
BTW, I had thought about a workaround, and maybe you can tell me if it will work:
Annotate one(any?) of the EClasses found in the ecore file with a teneo.jpa-sourced @NamedNativeQuery annotation. But I have the following questions:
- The (hibernate) documentation for the NamedNativeQuery annotation indicates that a resultclass needs to be provided, but since there is no really a class for it, how would that work? Would it be OK to just choose any, or would I need to create an EClass which maps directly to the result of my native sql query?
- Also, since the teneo hibernate mapping XML file is specifying which EClasses are really mapped and each EClass has a "table" property, what happens to the EClass I have chosen to add the @NativeNamedQuery annotation, since this is not really mapped to anything but a Native SQL Query?
Thank you
|
|
|
Re: [Teneo] Teneo Mapping XML file and Named Native Queries [message #1098058 is a reply to message #1098046] |
Fri, 30 August 2013 14:46 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Juan,
The annotations and the xml schema support the same annotations, so it is unsupported on the eclass also...
Yes in this case I think you have to create an eclass which reflects the result of the query. This is a normally mapped
eclass afaics.
Can't you create a database view and create an eclass for it? You can use the database view name as the name in the
table annotation, I think you can set attributes to tell hibernate to never update/insert anything for this eclass.
gr. Martin
On 08/30/2013 04:28 PM, juan velez wrote:
> Hi Martin,
>
> Yes, I will enter a bugzilla for it. Unfortunate I cannot use the named-query since this is the annotation used for HQL
> named queries, hence the need for the named-native-query as you pointed it out.
>
> BTW, I had thought about a workaround, and maybe you can tell me if it will work:
>
> Annotate one(any?) of the EClasses found in the ecore file with a teneo.jpa-sourced @NamedNativeQuery annotation. But I
> have the following questions:
>
> - The (hibernate) documentation for the NamedNativeQuery annotation indicates that a resultclass needs to be provided,
> but since there is no really a class for it, how would that work? Would it be OK to just choose any, or would I need to
> create an EClass which maps directly to the result of my native sql query?
>
> - Also, since the teneo hibernate mapping XML file is specifying which EClasses are really mapped and each EClass has a
> "table" property, what happens to the EClass I have chosen to add the @NativeNamedQuery annotation, since this is not
> really mapped to anything but a Native SQL Query?
>
> Thank you
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.05294 seconds