存储过程是否与NHibernate一起使用以返回参数/ ref_cursor,或者我需要将函数写入此函数

时间:2011-04-08 12:24:49

标签: oracle nhibernate stored-procedures

存储过程是否与NHibernate一起使用以返回参数/ ref_cursor,或者我需要将函数写入此函数。因为它正在使用函数而不是存储过程

@Diego:映射文件
 < ?xml version =“1.0”encoding =“utf-8”?>
   < hibernate-mapping xmlns =“urn:nhibernate-mapping-2.2”>
     < class name =“DomainObject.Employee,DomainObject”table =“Employee”>
       < id name =“EmployeeId”column =“Emp_ID”type =“int”unsaved-value =“0”>

         < generator class =“native”>
          < /发电机>
       < / ID>
    < property name =“EmployeePassword”column =“EMP_PASSWORD”type =“string”/>

    < property name =“EmployeeName”column =“EMP_NAME”type =“string”/>
    < property name =“TeamAssociatedWith”column =“TEAM_ASSOCIATED_WITH”type =“int”/>

    < property name =“IsCaptain”column =“IS_CAPTAIN”type =“string”/>
    < property name =“NumberOfMOM”column =“NO_OF_MOM”type =“int”/>

    < property name =“Balance”column =“BALANCE”type =“int”/>
  < /类>

< sql-query name =“selemployee”callable =“true”>
    < return class =“DomainObject.Employee,DomainObject”>
      < return-property name =“EmployeeId”column =“Emp_ID”/>
      < return-property name =“EmployeeName”column =“EMP_NAME”/>
      < return-property name =“EmployeePassword”column =“EMP_PASSWORD”/>
      < return-property name =“TeamAssociatedWith”column =“TEAM_ASSOCIATED_WITH”/>

      < return-property name =“IsCaptain”column =“IS_CAPTAIN”/>
      < return-property name =“NumberOfMOM”column =“NO_OF_MOM”/>
      < return-property name =“Balance”column =“BALANCE”/>
    < /返回>
    {? =致电GETPERSONTEST}
  < / SQL查询>
< /休眠映射>

存储过程Oracle
创建或替换PROCEDURE GETPERSONTEST(io_cursor out SYS_REFCURSOR)
IS
BEGIN
OPEN io_cursor FOR SELECT EMP_ID,EMP_NAME,EMP_PASSWORD,TEAM_ASSOCIATED_WITH,IS_CAPTAIN,NO_OF_MOM,BALANCE FROM employee;
结束GETPERSONTEST;

1 个答案:

答案 0 :(得分:1)

out ref cursor:yes。

其他任何事情:不。

请参阅http://www.nhforge.org/doc/nh/en/index.html#querysql-limits-storedprocedures