Run Stored Procedure on hibernate xml file

只谈情不闲聊 提交于 2019-12-11 08:05:54

问题


I have a SQL stored procedure that gives the menu which is assigned to each user, based on 'ID' and 'Code'. My application runs on Angular and uses Drools and Hibernate files to get all the data to populate the app.

On that moment i just want to list all the menu based on id and code, but i only get to list all the menu table (which has more than 1000 records) its like my hbm.xml file doesn't run the stored procedure.

Here's my hibernate file:

<hibernate-mapping>
   <class name="model.Menu" table="Table_MenuItem">   
      <composite-id>
        <key-property column="Id" name="id" type="int"/>
      </composite-id>
      <property column="labelEN" name="labelen" type="string"/>
    </class>
    <sql-query name="SP_ListMenuItems">
        <return alias="labelen" class="model.Menu">
            <return-property column="labelEN" name="labelen"/>
            </return>
            <![CDATA[CALL SP_ListMenuItems(null,null,null,null)]]>
    </sql-query>
</hibernate-mapping>

Here, Table_MenuItem is the table that has all the records (more than 1000) and SP_ListMenuItems is the stored procedure that accepts 4 parameters, SP_ListMenuItems(code,id,lang,condition), if all the parameters are null it should gives only 17 records, but that's note the case.. even with that hibernate file, that should give me only 17 records, i got more than 1000.

What am i missing? Thanks in advance

Edit: do i have to call the query on angular .ts file, how??

来源:https://stackoverflow.com/questions/50745276/run-stored-procedure-on-hibernate-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!