1. Only the first parameter of a stored procedure can be an OUT parameter. 2. You cannot have more than one OUT parameter and it must be the first parameter. 3. There are two ways to map your Java objects to the Stored Procedure results. One is where you map in an XML file one by one. the other is if the return result is the same structure of a table, then you can use the Java Object that is mapped to that table.
There are plenty of documents at hibernate's website for this.
There are plenty of documents at hibernate's website for this.
Hi. Can you point me to a java sample that shows how to do this for a stored procedure, as opposed to a function? All the hibernate docs I'm finding show the function way (and I have that running ok), but I don't yet see exactly how to do this using a stored proc, i.e. they explain the mapping file pretty well, but how do you set that first OUT parameter up on the java side?
Ben
Ching Liang Chin
Greenhorn
Joined: Jun 13, 2006
Posts: 3
posted
0
I am also facing the same problem and don't know how actually it works. Will very appreciate if anyone can share any sample coding on how to call the stored procedure with the out parameter.
Actually, there is a search feature that you can use on this forum. In a previous thread about SPs, I posted such code, if you search on it, you should be able to find it. Here is one of them, but it was actually posted after this thread was created, so you must have done some searching to find it.
Good Luck.
Mark
Ching Liang Chin
Greenhorn
Joined: Jun 13, 2006
Posts: 3
posted
0
Thank you Mark, the sample code help alot and I am able to call the Oracle 9i stored procedule and function already. Unfortunately, when I tried to call the stored procedure/function for MYSQL, it always give me the error as below, anyone got any idea what is wrong with the coding.
exception
org.apache.jasper.JasperException: could not execute query org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
Hmm, I haven't used stored procedures in MySql and/or with Hibernate. I suggest trying to find info at www.jboss.org at their wiki. I am sure there is a MySql call to stored procedure tutorial or example there.