Question

I want to Pass 'Map' to an PL/SQL Stored Procedure via Spring Mybatis Mapper XML. Is there any way i can pass it via using appropriate java type and jdbctype.I can use a Java class to map to appropriate TypeHandler, but is there any other way we can do this without using a type handler.

Was it helpful?

Solution

You have to use a TypeHandler. That's how MyBatis sets Java types set into Prepared and Callable Statements.

If you register the TypeHandler with your MyBatis configuration, then MyBatis will choose the correct type handler automatically, avoiding typing "typeHandler=..." in the sql map. That's how you can get it to use javaType variable to find your type handler.

i.e. (org.apache.ibatis.session.Configuration)

configuration.getTypeHandlerRegistry().register(HashMap.class, new MyPLSQLTypeHandler());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top