K
K
komarovba2019-11-18 14:52:30
Java
komarovba, 2019-11-18 14:52:30

How to work with mybatis + annotation + function?

Hello, I can’t figure out how to call the oracle function through annotations in mybatis.
Code example:
Maper:

@Select(value= "{   CALL #{outParam, jdbcType=NUMERIC, mode=OUT} := dbq.dbq_app.putmessageinqueue(#{lMess}, #{cIDChainLokBrig})}")
    @Options(statementType = StatementType.CALLABLE)
    @ResultType(int.class)
    int putmessageinqueue(@Param("lMess") String lMess,
                              @Param("cIDChainLokBrig") int cIDChainLokBrig);

Call class
try {
            Integer result = mapper.putmessageinqueue(lMess,cIDChainLokBrig);
            if (result!=null){
                return result;
            }
        }catch (Exception ignored){
            if (!ignored.toString().contains("No information for operation settings.")) {
                System.err.println("ERORR! Class:FunctionMyBatis; Function: putmessageinqueue " + ignored);
                log.error("ERORR! Class:FunctionMyBatis; Function: putmessageinqueue " + ignored);
            }
        }
        return 0;

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question