Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sameer sood
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
sameer sood
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic