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: How to Select Custom columns?
PostPosted: Thu Feb 07, 2008 5:31 am 
Newbie

Joined: Thu Feb 07, 2008 5:09 am
Posts: 1
Hello,

For example suppose I am working with Customer table of Northwind database.
I have a stored procedure named "GetCustomers" that selects CustomerID,ContactTitle,CompanyName from the customers table,

I have created a named query like:
<sql-query name="GetCustomers">
<return class="Domains.Customer, Domains" />
exec GetCustomers
</sql-query>

but the problem is an exception is generated telling that there are some wrong column name.
AND When i Select ALL the columns the query works correctly.

I also tried:
<sql-query name="GetCustomers">
<return class="Domains.Customer, Domains" >
<return-property name="CustomerID" column="CustomerID" type="String" />
<return-property name="ContactTitle" column="ContactTitle" type="String" />
<return-property name="CompanyName" column="CompanyName" type="String" />
</return>
exec GetCustomers
</sql-query>

The exception is also generated, I can only have it done if i used <return-scalar /> instead; but this will return a list of objects or object[] not the mapped entity.

Why Nhibernate cannot select some columns into the mapped entity and leave the rest columns with their default values?

Is there any way to come over this issue?

Thanks in advance!!


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.