小编All*_*anh的帖子

使用多个IN OUT参数和注释在MyBatis中调用存储过程

我在Oracle中调用一个存储过程,接收7个参数并返回5,我只对两个参数感兴趣.这是我的MyBatis Select

@Select(value = "{CALL prc_ultimo_nombramiento(#{tipoIdentificacion,    mode=IN},#{numeroIdentificacion, mode=IN},#{idEt, jdbcType=VARCHAR},#{fechaPosesion, mode=OUT, jdbcType=VARCHAR},#{idTipoNombramiento, mode=OUT, jdbcType=VARCHAR},#{validar, jdbcType=VARCHAR},#{mensaje, jdbcType=VARCHAR})}")
@Options(statementType = StatementType.CALLABLE)
@ResultType(CPDatosDocente.class)
CPDatosDocente obtenerDatosFechaPosesionIdNombramiento(CPDatosDocente datosDocente);
Run Code Online (Sandbox Code Playgroud)

我的CPDatosDocente是一个包含我需要的所有变量的POJO.

String idTipoNombramiento;
String validar;
String mensaje;
String fechaPosesion;
String tipoIdentificacion;
String numeroIdentificacion;
String idEt;
//Getters and setters...
Run Code Online (Sandbox Code Playgroud)

我有一个dao,我在调用MyBatis Sentence,但是当我调用procedure时,我的对象(CPDatosDocente)为null

  public CPDatosDocente obtenerFechaPosesionIdNombramiento(Long tipoIdentificacion,
        Long numeroIdentificacionDocente) {
    SqlSession session = sf.openSession();
    try {
        // Se abre conexión con el mapper
        CPDatosDocenteMapper mapper = session.getMapper(CPDatosDocenteMapper.class);
        // Se ejecuta la consulta para obtener la fecha de posesión y el
        // …
Run Code Online (Sandbox Code Playgroud)

java oracle stored-procedures mybatis

2
推荐指数
2
解决办法
5208
查看次数

标签 统计

java ×1

mybatis ×1

oracle ×1

stored-procedures ×1