This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate call to Stored Procedure that does not return anything Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate call to Stored Procedure that does not return anything " Watch "Hibernate call to Stored Procedure that does not return anything " New topic

Hibernate call to Stored Procedure that does not return anything

raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
Hi All,
I am trying to call store procedure in hibernate .but i am not getting result.
please give me solution.

public List<User> getList() {
System.out.println("I am inside getList() class");
List<User> list = null;
try {
Session session = HibernateUtill.currentSession();

SQLQuery sq= (SQLQuery) session.getNamedQuery("selectAllEmployees_SP");

list= sq.list();
System.out.println("results----- ."+list);


} catch (Exception e) {
return list;

this is pojo class

this is Stored procedure of sql server 2005

org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
at org.hibernate.exception.SQLStateConverter.convert(
at org.hibernate.exception.JDBCExceptionHelper.convert(
at org.hibernate.loader.Loader.doList(
at org.hibernate.loader.Loader.listIgnoreQueryCache(
at org.hibernate.loader.Loader.list(
at org.hibernate.loader.custom.CustomLoader.list(
at org.hibernate.impl.SessionImpl.listCustomQuery(
at org.hibernate.impl.AbstractSessionImpl.list(
at org.hibernate.impl.SQLQueryImpl.list(
at com.lara.Dao.LoginDao.getList(
at com.lara.web.LoginAction.execute(
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(
at org.apache.struts.chain.commands.ActionCommandBase.execute(
at org.apache.commons.chain.impl.ChainBase.execute(
at org.apache.commons.chain.generic.LookupCommand.execute(
at org.apache.commons.chain.impl.ChainBase.execute(
at org.apache.struts.chain.ComposableRequestProcessor.process(
at org.apache.struts.action.ActionServlet.process(
at org.apache.struts.action.ActionServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
Caused by: The value is not set for the parameter number 1.
at org.hibernate.dialect.SybaseDialect.getResultSet(
at org.hibernate.jdbc.AbstractBatcher.getResultSet(
at org.hibernate.loader.Loader.getResultSet(
at org.hibernate.loader.Loader.doQuery(
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
at org.hibernate.loader.Loader.doList(
... 31 more

Raj Jaiswal
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
all i solve this problem.
if any body have any query or any dought regarding this ...
Please send me query ...

Raj Jaiswal
Anjaana Anjaani

Joined: Sep 26, 2010
Posts: 1
Hi Jaiswal, Hi this is rohit here. I am also facing the same problem. Could you please tell me the solution of it. If possible please let me know the hibernate mapping file configuration, your Stored Procedure, your java class from where you are calling the stored procedure..... you can mail me at help me
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hi Rohit
exactly where are you getting problem please let me know .

subject: Hibernate call to Stored Procedure that does not return anything
Similar Threads
query a database table using a foreign key ( where) using Hibernate.
Executing storedprocedure through HIBERNATE in SPRING
Hibernate/Native SQL and null inparams
. java.lang.IllegalArgumentException: callable not yet supported for native queries
how to insert data in stored procedure from hibernate?