-->
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.  [ 2 posts ] 
Author Message
 Post subject: Returned lists always have one fewer row than they should!
PostPosted: Mon Sep 13, 2004 2:47 pm 
Newbie

Joined: Fri Sep 10, 2004 3:10 pm
Posts: 4
Hibernate version:
2.1
Mapping documents:

<class name="Merchant" table="MERCHANT" proxy="Merchant">
<id name="id" type="long" column="MERCHANTID">
<generator class="native"/>
</id>
<property name="name" column="NAME"/>
</class>

Code between sessionFactory.openSession() and session.close():

String sql = "select {m}.MERCHANTID as {m.id}, {m}.NAME as {m.name} " +"from MERCHANT {m} join PERSON p on {m}.MERCHANTID=p.MERCHANTID " + "where p.PERSONID=" + person.getId();
Query sqlQuery = session.createSQLQuery(sql, "m", Merchant.class);
List merchants = sqlQuery.list();

Full stack trace of any exception that occurs:
No Exception

Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
select m.MERCHANTID as MERCHANTID0_, m.NAME as NAME0_ from MERCHANT m join PERSON p on m.MERCHANTID=p.MERCHANTID where p.PERSONID=110

Debug level Hibernate log excerpt:


All of my list queries such as the above returns one fewer row than
they should be. That is, if I take the SQL generated and run it
directly, I get N rows. Hibernate, however, always returns N-1 rows
on the same query. What is going on???

Thanks.

Maroon


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 5:23 pm 
Newbie

Joined: Fri Sep 10, 2004 3:10 pm
Posts: 4
never mind. I found the problem in my code


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

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.