In my program, i need get a exec a store procedure to decide to get a object from which table, so i need config a stored procedure in my entity nhibernate config file, the config file like below:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Entity.ACC.User, Entity" table="ACC_User" lazy="false">
<id name="Id" column="Id" type="Int32" unsaved-value="0" >
<generator class="increment" />
</id>
<property name="Code" column="Code" type="String" length="50" />
<property name="Password" column="Password" type="String" length="50" />
<property name="FirstName" column="FirstName" type="String" length="50" />
<property name="LastName" column="LastName" type="String" length="50" />
<property name="Type" column="Type" type="Int16" />
<property name="Email" column="Email" type="String" length="50" />
<property name="TelPhone" column="TelPhone" type="String" length="50" />
<property name="MobilePhone" column="MobilePhone" type="String" length="50" />
<property name="Language" column="Language" type="String" length="50" />
<property name="IsActive" column="IsActive" type="Boolean" />
<property name="AccountExpired" column="AccountExpired" type="Boolean" />
<property name="AccountLocked" column="AccountLocked" type="Boolean" />
<property name="PasswordExpired" column="PasswordExpired" type="Boolean" />
<property name="CreateUserId" column="CreateUser" type="Int32" update="false" />
<property name="CreateUserName" column="CreateUserNm" type="String" length="100" update="false" />
<property name="CreateDate" column="CreateDate" type="DateTime" update="false" />
<property name="LastModifyUserId" column="LastModifyUser" type="Int32" />
<property name="LastModifyUserName" column="LastModifyUserNm" type="String" length="100" />
<property name="LastModifyDate" column="LastModifyDate" type="DateTime" />
<sql-insert>
exec USP_User_Insert ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
</sql-insert>
<sql-update>
exec USP_User_Update ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
</sql-update>
<sql-delete>
exec USP_User_Delete ?
</sql-delete>
</class>
<sql-query name="User_Select">
<return class="Entity.ACC,Entity.ACC.User"/>
exec USP_User_Select ?
</sql-query>
</hibernate-mapping>
after i added this query SP in the config file
exec USP_User_Select ?
the program can’t run and will throw exception as:
unknown class Entity.ACC, Entity.ACC.User
what should i do let the SP work.
many thanks.
Try changing
return class=”Entity.ACC,Entity.ACC.User”
line into
return class=”Entity.ACC.User, Entity”