-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SP's and pagination...
PostPosted: Wed Apr 27, 2005 5:13 pm 
Regular
Regular

Joined: Mon Sep 29, 2003 9:39 am
Posts: 67
Hibernate version:
hibernate3.jar (april 18th?)
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="com.X" mutable="false" table="x" >
<id name="id" column="x_id" type="int"/>   
<loader query-ref="selectXByY"/>
</class>
<sql-query name="selectXByY" callable="true">
   <return alias="xz" class="com.X" lock-mode="none">
      <return-property name="id" column="x_id"/>

   </return>   
   select_x_by_y(?)
</sql-query>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Code:
        Query query = session.getNamedQuery("selectXbyY");
         query.setInteger(0, bean.getY());
         query.setFirstResult(bean.getFirstResult());
         query.setMaxResults(bean.getMaxResults());
         return query.list();


Full stack trace of any exception that occurs:
java.sql.SQLException: Invalid parameter index 1.

Name and version of the database you are using:
mssql2k jtds 1.0.3
The generated SQL (show_sql=true):
Hibernate: select top 10_x_by_y(?)

It makes sense for this not to work - but from an API user's perspective,
it looks like it should work.

Should this be added to to the ref section:
16.3.2.1. Rules/limitations for using stored procs

Or am I missing something here?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.