Solved

java data structure into stored procedures

Posted on 2007-04-05
6
178 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
thymeleaf natural templating vs JSP 2 104
servlet example issue 6 40
How to convert String matching to regex in java 4 34
Java: anonymous class 4 22
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 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