How to access Oracle function (with default parameters) using Hibernate?

I have my function defined below in an Oracle 10g database that returns ref_cursorand the input parameter has a default value of 2

FUNCTION fn_get_client(pv_clientId_len_i IN NUMBER DEFAULT 2)
    RETURN gtyp_ref_cur;

This is how I call the function from hibernate - the contents of the hibernate mapping file

<hibernate-mapping package="com.synapsegroupinc.services.crm.ExplainLanguageService.model">
    <class name="ClientInfo" schema="IVR">      
        <id name="clientId" column="client_id" type="string" />
        <property name="clientDesc" column="client_desc" type="string" />        
    </class>
   <sql-query name="FN_GET_CLIENT" callable="true">
        <return class="ClientInfo">
            <return-property name="clientId" column="client_id"/>
            <return-property name="clientDesc" column="client_desc" />         
        </return>
        { ? = call PKG_CAMS_IVR_CRM.FN_GET_CLIENT(?) }
    </sql-query>  
</hibernate-mapping>

Problem : everything works fine when I pass the input value when the function is called. However, I need it to work, so when I call the function without input, so I need to use the default value.

I searched many times, but no luck, could hibernate support default parameters or not when calling a function / stored procedure.

Thanks to everyone.

+3
source share
1

, ? jdbc ? , ?

, fn_get_client ? , . ...

0

Source: https://habr.com/ru/post/1794776/


All Articles