-->
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: Correct row count, but repeated data
PostPosted: Wed Mar 01, 2006 6:45 pm 
Newbie

Joined: Tue Aug 30, 2005 9:04 pm
Posts: 9
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
hibernate 3.1
Mapping documents:
Code:
<hibernate-mapping>
    <class name="com.mycomp.client.domain.Sinvcmb" table="SINVCMB">
        <composite-id name="id" class="com.mycomp.client.domain.SinvcmbId">
            <key-property name="ioqryid" type="integer">
                <column name="IOQRYID" />
            </key-property>
            <key-property name="iocvar" type="string">
                <column name="IOCVAR" length="4" />
            </key-property>
            <key-property name="iocsto" type="string">
                <column name="IOCSTO" length="4" />
            </key-property>
            <key-property name="iocgrd" type="string">
                <column name="IOCGRD" length="4" />
            </key-property>
            <key-property name="iocpck" type="string">
                <column name="IOCPCK" length="4" />
            </key-property>
            <key-property name="iocbrn" type="string">
                <column name="IOCBRN" length="4" />
            </key-property>
            <key-property name="iocloc" type="string">
                <column name="IOCLOC" length="2" />
            </key-property>
            <key-property name="iocspc" type="string">
                <column name="IOCSPC" length="6" />
            </key-property>
        </composite-id>
        <property name="ioqryts" type="timestamp">
            <column name="IOQRYTS" length="26" not-null="true" />
        </property>
        <property name="inrcd" type="character">
            <column name="INRCD" length="1" not-null="true" />
        </property>
        <property name="infil1" type="string">
            <column name="INFIL1" length="5" not-null="true" />
        </property>
        <property name="inctc" type="character">
            <column name="INCTC" length="1" not-null="true" />
        </property>
        <property name="inpi1" type="integer">
            <column name="INPI1" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi2" type="integer">
            <column name="INPI2" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi3" type="integer">
            <column name="INPI3" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi4" type="integer">
            <column name="INPI4" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi5" type="integer">
            <column name="INPI5" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi6" type="integer">
            <column name="INPI6" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi7" type="integer">
            <column name="INPI7" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi8" type="integer">
            <column name="INPI8" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi9" type="integer">
            <column name="INPI9" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi10" type="integer">
            <column name="INPI10" precision="7" scale="0" not-null="true" />
        </property>
        <property name="inpi11" type="integer">
            <column name="INPI11" precision="7" scale="0" not-null="true" />
        </property>
...



this file doesn't have a primary key, but i created one in order to run the reverse engineering, and then removed it.

Code between sessionFactory.openSession() and session.close():
Code:
      return getHibernateTemplate().executeFind(new HibernateCallback(){
         public Object doInHibernate(Session session) throws HibernateException, SQLException {      
            
            /*
            List list = session.createSQLQuery("select * from sinvcmb where ioqryid = " + FC)
             .addEntity(Sinvcmb.class)
             .list();
            */
            
            Query query = session.createQuery(hql);   
            query.setParameter("FC",new Integer(FC));
            query.setFirstResult(start);
            query.setMaxResults(rows);
            ScrollableResults sr = query.scroll() ;
            while (sr.next() )
            {
               Object[] cols = sr.get();
               for (int i = 0 ; i < cols.length ; ++i)
                  System.out.print(((Sinvcmb)cols[i]).getInbrnd() + "  ");
               System.out.println();
            }
            
            return query.list();
         }
      });

Full stack trace of any exception that occurs:
no errors.
Name and version of the database you are using:
db2/400 v5r3
The generated SQL (show_sql=true):
select * from sinvcmb where ioqryid = 517353031
Debug level Hibernate log excerpt:


The list of domain objects returned contain the correct number of rows, but each row is the same (it just repeats the first row it finds). Both HQL and native SQL query methods give me the same results. It works with JDBC directly. Any help would be appreciated, thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 8:24 pm 
Newbie

Joined: Tue Aug 30, 2005 9:04 pm
Posts: 9
somebody? anybody??


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.