NamedParameterJdbcTemplate的使用

    xiaoxiao2022-06-23  20

    sql 要写成这样:

    INSERT INTO employees (last_name, email, dept_id) VALUES (:lastName,:email,:dept_id.id)

    其中lastName,email,dept_id对应pojo类employee里面的属性:

    private Integer id; private String lastName; private String email; private Department dept_id;

    其中还有pojo类Department

    private Integer id; private String name;

    两个都进行序列化处理,然后因为表employees在mysql中dept_id 是Int属性,所以使用级联属性。

    转载请注明原文地址: https://ju.6miu.com/read-1123392.html

    最新回复(0)