dp.update(temp);
returnMessage = "保存成功";
}
public void addProblem() throws EasyJException {
Problem problem = (Problem) object;
problem.setCreatorId(userId);
problem.setBuildTime(new java.sql.Date(System.currentTimeMillis()));
problem.setUpdateTime(new java.sql.Date(System.currentTimeMillis()));
/* todo:将来需要改成用户对应的角色 */
problem.setRoleId(new Long(1));
problem.setStatusId(new Integer(0));
problem.setProblemAward(new Short((short) 0));
problem.setVotingNum(new Long(0));
if (problem.getProblemId() == null)
problem = (Problem) dp.create(problem);
else {
problem.setUseState("Y");
dp.update(problem);
}
String problemContent = request.getParameter("problemContent");
// 增加完problem之后,需要增加对应的problem_version
ProblemVersion version = new ProblemVersion();
version.setCreatorId(userId);
version.setProblemContent(problemContent);
version.setProblemId(problem.getProblemId());
version.setProblemVersionId(new Long(1));
dp.update(version);
returnMessage = "problemId=" + problem.getProblemId() + "<message>保存成功";
}