Solved

java data structure into stored procedures

Posted on 2007-04-05
6
185 Views
Last Modified: 2010-03-31
Is it possible to pass Java data objects to  stored procedures?

I have a stored procedure framework that accepts in parameters and returns ouput..but now ..I have a huge data structure of 150 fields to be passed in as input parameters which makes it impossible to type all that in the SP as input.. How do I do this?

0
Comment
Question by:skn73
  • 2
6 Comments
 
LVL 3

Expert Comment

by:cavey_79
ID: 18857750
Quick answer...you can't. You will probably need to create a single value (like a huge comma separated string) that you would pass into the stored procedure.
Then, in the stored procedure, you would parse it and split it into little pieces.

You can also try having 150 parameters to the stored proc, however that might be a problem with some databases that will limit the number of parameters to a stored proc.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18861133
Even if it is possible, its not advisable either because then you limit yourself to only those databases which support Java objects. You won't be able to port or migrate to other databases. I would say keep the application layer generic of the database and let the DAO layer communicate with the database using stored procedures by passing data in the form of whatever complies with plain SQL specifications
0
 

Author Comment

by:skn73
ID: 18863568
I dont agree its not possible at all .. there should be some way ..
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 500 total points
ID: 19011120
You can pass Java objects to stored procedures but that would heavily tie your application to the database and I would say that is bad architecture:

http://forum.java.sun.com/thread.jspa?threadID=757466
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to install java on RHEL image on EC2 4 57
hibernate example using maven 12 82
What browser will run Java? 7 127
American Express @Work site and Java 4 68
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question