Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

java data structure into stored procedures

Posted on 2007-04-05
6
Medium Priority
?
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

596 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