• 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

Calling Stored Procedure with list of values

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

I have a requirement like this. I have set of applications (application is a java object). Every application has a set of fields (Field is a java object). Every field has set of attributes. I need to store multiple fields for a specified application at one go.
I have a stored procedure with following signature.


Where FIELDS_TYP is an OBJECT defined as follows. [I removed and renamed some of the fields to make it simple]



This stored procedure can take list of field objects in single invocation.

How should invoke this stored procedure with a list of field objects from java code in single invocation using Spring 3 JDBC module. I am not using any of the ORM tools.
Note: Since I want to write a generic code, I am not supposed to use any of the database specific APIs like ARRAY from Oracle.

Please suggest me some solution.

Thanks,
Chinna
 
Chinababu Illa
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,

I have read the documentation, but I didn't completely understand. There is very little information in the documentation about calling stored procedure with list of objects.
But, now my problem is resolved after going though one of your links and the spring documentation together. I could not do it anyway without Oracle's ARRAY and STRUCT types.

What I have actually done is, I created STRUCT object for each set of input values and kept them in ARRAY object and passed this ARRAY object to stored procedure. Now it worked.

For anyone's reference, I am posting complete working code below.



Thanks Bill,


-Chinna
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chinna,

Your welcome and thanks for posting back with your solution.
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic