Reputation: 699
I'm using Mybatis
3.2
, Orace 12c
for my project. I used code generator to generate insert()
method. In the <insert>
tag it has schema name; for ex:
insert into CPORTAL.CARD_USER_MASTER
Now, the schema is dynamic, so I put the parameter to change the schema:
insert into ${schema}.CARD_USER_MASTER
Parameter schema
is defined in mapper.java
as
insert(CardUserMaster record, @Param("schema") String schema)
However, without that schema, insert works but when has schema, error happen:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'carduserSeqno' not found. Available parameters are [0, schema, param1, param2]
In other class I set schema parameter like that on insert
method and it works. Don't know what happen to this class.
Any comments will be appreciated.
Thanks.
Upvotes: 0
Views: 680
Reputation: 57381
Change it to
insert(@Param("entity") CardUserMaster record, @Param("schema") String schema)
and use the params as entity.carduserSeqno
in the SQL.
Looks like it cannot recognize that 0 parameter is POJO. Without the @Param("schema")
it uses pojo fields directly as params btu with adding the schema
param it cannot.
Upvotes: 1