spring jdbctemplate.query 方法给我这个异常无效参数 java.io 不可序列化异常

spring jdbctemplate.query method gives me this exception invalid argument java.io Not Serializable exception

[在此处输入图片描述][1] 这是我得到 java.ioNotSerializabale 异常的代码 当我 运行 下面的查询时,我得到了这个异常

java.io.NotSerializableException

我的 pojo class 在这里 public class ProjectHelper 实现 Serializable {

private String name;
private String description;
private String company;
private String category;
private List<UserRegister> usersRegisterList;

private String startDate;

这是我的 DaoImpl 方法,但出现错误 "java.io.NotSerializableException"

@Override
public GenericModal getProjects(User email) throws SQLException {

    String sql = "select p.project_name, p.project_description, p.company,                      p.start_date, p.end_date, " +
            "p.category f.task, f.milestones, f.billing, f.time_log, f.messages, f.features_id, f.files, u.firstName" +
            "u.lastname, u.email" +
            " from project as p" +
            "join userprojectrelation as upr" +
            "on p.project_id=upr.project_id " +
            "join users as u" +
            "on u.UserId=upr.user_id" +
            "join features as f " +
            "on f.project_id=p.project_id" +
            "where u.email=?";
    int status = 0;
    GenericModal genericModal=new GenericModal();

    try {
        List<ProjectHelper> projectHelper=jdbcTemplate.query(sql,new Object[]{email},new ProjectHelperMapper());
        if (projectHelper.isEmpty()) {
            return null;
        } else {
            genericModal.setObject(projectHelper);
        }
       // return genericModal;
    } catch (Exception ex) {
        genericModal.setException(ex.getMessage());
    }

    return genericModal;
}

可能是 UserRegister 不是可序列化的。如果你想序列化一个 class,它的所有组件(字段)也必须是可序列化的,除非你实现自定义序列化方法或将字段标记为瞬态。