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属性,所以使用级联属性。