也许我没有明显的东西,但我无法得到一个简单的地图,以成功执行。
Using the following interface
public interface CustomItemMapper
{
Integer insert(CustomItem item, @Param("extra") String someparam);
}
以及以下XML绘图
<insert id="insert" useGeneratedKeys="false" parameterType="map" keyProperty="id">
insert into CustomItem (id, column2, column3, column4, column5, column6)
values (#{id}, #{field2}, #{field3}, #{field4}, #{field5}, #{extra})
</insert>
and this code
SqlSessionFactory sqlSessionFactory = (SqlSessionFactory) servletContext.getAttribute("SqlSessionFactory");
SqlSession session = sqlSessionFactory.openSession();
try
{
CustomItemMapper mapper = session.getMapper(CustomItemMapper.class);
mapper.update(item);
session.commit();
}
finally
{
session.close();
}
I get the following debug output:
Checked out connection 368716606 from pool.
ooo Connection Opened
==> Executing: insert into CustomItem (id, column2, column3, column4, column5, column6) values (?, ?, ?, ?, ?, ?)
==> Parameters: null, null, null, null, null, actual_value_of_extra(String)
xxx Connection Closed
Returned connection 368716606 to pool.
之后是例外(不能进入id
栏)。
因此,适当传递的唯一价值是额外供应的扼杀。 我已经核实,实地名称正确无误,此时此刻,物体不作废,这些田地都适当居住。
I also tried using parameterType="CustomItem"
instead of parameterType="map"
but the result did not change.
I would appreciate if someone could let me know what I am missing here.
Thanks in advance.
PS:我也把发言插入同一个问题。