But are you trying to map a SELECT into a class?

If so, then that you should use Subselect() instead of table. Here is a 
sample .hbm.xml mapping:

 

<class name="BlogPost">

                 <subselect>

                          <![CDATA[

                          SELECT blog_id, (SELECT COUNT(1) FROM post WHERE 
post.blog_id = blog.blog_id) post_count FROM blog

                          ]]>

                 </subselect>

                 <synchronize table="blog"/>

                 <synchronize table="post"/>

                 <id column="blog_id" name="BlogId"/>

                 <property name="PostCount" column="post_count"/>

         </class>

 
RP


On Saturday, October 4, 2014 6:46:41 PM UTC+1, Ricardo Peres wrote:
>
> What string are you settings as SqlInsert?
>
> RP
>
> On Thursday, October 2, 2014 2:34:55 PM UTC+1, pasquale wrote:
>>
>> I'm not sure if I'm wrong or this is a missing feature. 
>> In mapping-by-code: in a special case, I need to custumize my SqlInsert, 
>> SqlXXX mapping with specific sql statements (xref NH-3650). 
>> When SqlInsert is invoked, I have a runt-time error Invalid Index {0} 
>> SqlParameterCollection etc etc. 
>> I suppose that I need to set check == null to tell to NH to evaluate 
>> only the params passed in SqlInsert, but I can't see how accomplish my 
>> task... 
>> I'm wrong or is a missing feature? 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to