Solved

java data structure into stored procedures

Posted on 2007-04-05
6
172 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:mayankeagle
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:
mayankeagle 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
json format text only 4 65
wordmultiple challenge 12 90
solarwind tftp server 2 31
Java passing arguments (type error) 2 35
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now