aspose file tools*
The moose likes Object Relational Mapping and the fly likes  java.sql.SQLException: Parameter #1 has not been set. with hibernate/sybase/jtds executing StoreP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark " java.sql.SQLException: Parameter #1 has not been set. with hibernate/sybase/jtds executing StoreP" Watch " java.sql.SQLException: Parameter #1 has not been set. with hibernate/sybase/jtds executing StoreP" New topic
Author

java.sql.SQLException: Parameter #1 has not been set. with hibernate/sybase/jtds executing StoreP

sameer sood
Ranch Hand

Joined: Dec 05, 2007
Posts: 30
Hi,

I am getting the following error while executing store proc

Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at com.rbs.ird.cachemgr.dao.DefaultStaticDataLoaderStrategy.loadClassDataFromDatabase(DefaultStaticDataLoaderStrategy.java:44)
at com.rbs.ird.cachemgr.dao.DefaultStaticDataLoaderStrategy.main(DefaultStaticDataLoaderStrategy.java:66)
Caused by: java.sql.SQLException: Parameter #1 has not been set.
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:649)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:777)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 8 more

code

Query tempQuery = session.getNamedQuery(classLoaderInfo.getNamedQuery());
query = session.createSQLQuery(tempQuery.getQueryString());
List<?> results = query.list();


hibernate file def has following call to store proc

{ ? = call get_p() }

for the named query getP.


I want the results to map to the class P.

Quick help is appreciated

Thanks,


Sameer Sood
SCJP 1.5 (93%), SCWCD 1.5 (95%)
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Why are you creating a query by asking the query-string of another query?

Also why do you have a questionmark in your stored procedure?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
sameer sood
Ranch Hand

Joined: Dec 05, 2007
Posts: 30
Hi

That can be safely ignored

That is the how it has been defined in the hbm file.

I have resolved this, thanks for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: Parameter #1 has not been set. with hibernate/sybase/jtds executing StoreP
 
Similar Threads
problem using hibernate and stored procedures for reading portion of data from database
Parameter not being set in HQL
Hibernate call to Stored Procedure that does not return anything
Calling Stored proc using Hibernate @NamedNativeQuery
Error in named native query (Invalid Column Name)