views:

895

answers:

1

When i map columns from the inspected table, i do this:

<property name="InstanceName" type="MyNameUserType, MyApp.MyNamespace">
   <column name="Name"/>
   <column name="Name2"/>
</property>

How can I make property mapping initialize a UserType with data retrieved by the formula's sql query?

<property name="InstanceName" type="MyNameUserType, MyApp.MyNamespace" formula="(...)"/>

fails with an exception "wrong number of columns".

Thanks in advance!

+1  A: 

MyUserNameType should be a class level mapping so that you can map the result of the SQL function to a class. See these two posts for some possible help:

  1. Class and SQL Function example: http://thoughtspam.spaces.live.com/blog/cns!253515AE06513617!478.entry

  2. NHibernate Mapping with formula mapping example: http://thoughtspam.spaces.live.com/blog/cns!253515AE06513617!477.entry

Michael Gattuso
thanks for your answer.i've tried the way you provided in post2 but it gave me nothing. looks like the UserType just doesn't see any column of the resulting dataset :(
npeBeg