-->
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: Strange behaviour of session.getNamedQuery(".......").list()
PostPosted: Fri Jun 25, 2010 3:01 am 
Newbie

Joined: Fri Jun 25, 2010 2:34 am
Posts: 1
Hi All,
I have a problem with the list being generated by the session.getNamedQuery(".......").list().
The results are totally different from the one that are being generated out of hibernate query shown in console(i enabled show_sql=true)
Here is the query
Code:
<query name="com.imedx.falcon.dao.DocumentDAO.getDocumentsForSubmittingAndFinalizing">
      <![CDATA[
      SELECT cdaDoc
      FROM com.imedx.falcon.model.CDADocument cdaDoc, com.imedx.falcon.model.UserProfile up
      WHERE cdaDoc.profileId = up.profileId
      AND  cdaDoc.uploadStatus = 0
      AND  cdaDoc.profileId > 0
      ORDER BY  cdaDoc.docId,up.roleTypeId
       ]]>
   </query>

Calling Java code:
Code:
cdaDocumentsList = session.getNamedQuery("com.imedx.falcon.dao.DocumentDAO.getDocumentsForSubmittingAndFinalizing")
               .list();


Actual expected result: 5 different rows of CDADOc object but from list() method im getting 2 different objects being repeated 2 times and 3 times each.
Unable to figure out the main culprit.


Another interesting thing is:
I get accurate results when i try to get actual fields from the database rather than the row
i.e
Code:
SELECT cdaDoc.cdaObjectId, cdaDoc.docLocation, cdaDoc.docName, cdaDoc.voiceFileId,
            cdaDoc.profileId,cdaDoc.interimDocName
      FROM com.imedx.falcon.model.CDADocument cdaDoc, com.imedx.falcon.model.UserProfile up
      WHERE cdaDoc.profileId = up.profileId
      AND  cdaDoc.uploadStatus = 0
      AND  cdaDoc.profileId > 0
      ORDER BY  cdaDoc.docId,up.roleTypeId

this works..but i want the whole row object


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.