• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

eclipselink stored procedures with result returned from different tables

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Will the book explain how to handle stored procedures? Some scenarios, for instance with EclipseLink and a mix of tables in the returned result.

We have made some stored procedure code, the result from the stored procedure containing a mix of two tables (destinationNumber from ported; networkRoutingPrefix from network).
Is the below way correct and efficient?










thanks,
Rene
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure what book you are referring to.

Your stored procedure call seems ok. Although odd that you define it using annotations as a named query, but then create a new call to execute it. You could just use the named query (although if your call works, it seems your procedure returns a result-set not output parameters).
 
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,

We have tried to keep the book vendor-neutral and focused on the specification itself, and since stored procedures are not defined in the spec we did not include them. However, they are on my feature list for the JPA 2.1 specification, so there is a good chance they will be in the next edition of the book.

As James mentioned, since you are defining a named query you might want to stick with that and keep the vendor-specific code out of your method.
 
Rene Ummels
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Good feedback. So, if I understand you correctly this would mean to change the code as follows, right?




kind regards,
Rene
 
Mike Keith
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no @ in the JPA query parameter name. It is just the name that you specified as the queryParameter when you defined the query, which was portedNumber.
 
Rene Ummels
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mike.
I now substituted:

by:


Then I executed the createNamedQuery() code but I get an exception:
Caused by: java.lang.IllegalArgumentException: NamedQuery of name: ported.p_sel_number_info not found.
How can I solve this?


thanks,
Rene
 
Mike Keith
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,

Your entity manager should be from the EMF of the same persistence unit as the Result entity or the query name won't be in that namespace. If you think that is okay in your app then you might want to go through the EclipseLink forums for more specific help. They are pretty helpful there.
 
Rene Ummels
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The actual solution was to update the sybase stored procedure from:

to:


In this way, the columns were mapped correctly.


br,
Rene
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic