Nhibernate nibernate调用mysql存储过程

Nhibernate nibernate调用mysql存储过程,nhibernate,stored-procedures,Nhibernate,Stored Procedures,我有一个带有两个参数的存储过程,返回一个int my mapping.hbm.xml <sql-query name="CreateAttribute"> <query-param name="idAttrType" type="int"/> <query-param name="idSystemUser" type="int"/> call CreateAttribute :idAttrType,:id

我有一个带有两个参数的存储过程,返回一个int

my mapping.hbm.xml

    <sql-query name="CreateAttribute">
        <query-param name="idAttrType" type="int"/>
        <query-param name="idSystemUser" type="int"/>
        call CreateAttribute :idAttrType,:idSystemUser
    </sql-query>
然后,我收到以下信息:

[SQL:调用CreateAttribute?p0,?p1]-->MySql.Data.MySqlClient.MySqlException:您的SQL语法有错误

有什么建议吗?

应该是:-

   <sql-query name="CreateAttribute">
        <query-param name="idAttrType" type="int"/>
        <query-param name="idSystemUser" type="int"/>
        call CreateAttribute(:idAttrType,:idSystemUser);
    </sql-query>

修改调用如下 选择调用CreateAttribute(0,0);--它起作用了

新的映射现在是

    <sql-query name="CreateAttribute">
       <query-param name="idAttrType" type="int"/>
       <query-param name="idSystemUser" type="int"/>
       select CreateAttribute(:idAttrType,:idSystemUser);
    </sql-query>

选择CreateAttribute(:idAttrType,:idSystemUser);

试过了。现在我得到了一个:过程sampledb.CreateAttribute不存在只是为了澄清一下,我尝试替换的内联sql是:插入到杂项值中(CreateAttribute(12,$userid),$userid,'$title','$details','$startdate','$enddate','$isongoing','$xml');“。显然,我会将语句分解为两部分,一部分用于调用过程,另一部分用于Insertcall CreateAttribute(0,0);-->procedure sampledb.CreateAttribute不存在,因此数据库中不存在存储的过程?您需要先创建它!我对此很感兴趣,因为我只使用
调用SP_NAME(param);
要调用MySql Sp,可以发布实际的存储过程吗?事实证明,CreateAttribute(,)是一个函数而不是过程,因此只能在另一个语句的上下文中使用(在本例中为SELECT)。
call CreateAttribute(0,0);
    <sql-query name="CreateAttribute">
       <query-param name="idAttrType" type="int"/>
       <query-param name="idSystemUser" type="int"/>
       select CreateAttribute(:idAttrType,:idSystemUser);
    </sql-query>