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: Sql-Query NHibernate
PostPosted: Sun Feb 08, 2009 12:30 pm 
Newbie

Joined: Sun Feb 08, 2009 12:18 pm
Posts: 1
New to NHibernate so please be patient. This might be something really simple..

I have a named sql-query in my mapping file (SummaryObject). It runs fine but the results are the same object. Note, the record count is correct.

I think the problem is because I am returning 0 for my ID but I have to since the query is actually quering different (details) tables that eventually will be inserted into my summaryObject. If I leave out the ID from the query I get an error.

Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2009 8:51 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
You definetely need some king of id. Otherwise hibernate can't distinguish the objects. If you don't have on in your query try to use a surrogate id, e.g ROW_NUMBER() or a combination of some columns which are unique. But have in mind that using ROW_NUMBER() might not be repeatable in the assigned ids.

But it's hard to give you more advice without knowing more about the objects and the query.

_________________
--Wolfgang


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.