sqlexception

9wbgstp7  于 2021-06-27  发布在  Java
关注(0)|答案(0)|浏览(240)

我试图添加线程评论时,按下回复按钮。我想用活动对象来做。当我按下按钮时,它通常需要写入名为 AO_C21EEC_THREADED_COMMENTS 在数据库中自动创建。但我有个错误:
[common.error.jersey.throwableexceptionmapper]rest服务引发的未捕获异常:活动对象库引发了sql异常:数据库:
name:postgresql version:9.3.24小调version:3 major version:9 driver: name:postgresql native 司机version:postgresql 9.0 jdbc4(内部版本801)org.postgresql.util.psqlexception:错误:关系“public.ao\u c83514\u threaded\u comments\u id\u seq”不存在位置:16
当我想在表中添加注解时 AO_C21EEC_THREADED_COMMENTS ,它希望将数据添加到另一个表中( public.AO_C83514_THREADED_COMMENTS_ID_seq ).
我的addcomment函数如下:

@POST
@AnonymousAllowed
@Produces({MediaType.APPLICATION_JSON})
@Path("/addcomment")
public Response addComment(final CommentModel comment)
{

  final Comment commentObj = commentManager.getCommentById(comment.getParentCommentId());

  if(comment == null || comment.getIssueId() == null || comment.getParentCommentId() == null || comment.getCommentBody() == null) {
    return Response.notModified("Required parameters are missing.").build();
  }
  if(commentObj == null) {
    return Response.notModified("Wrong comment id.").build();
  }

  final ApplicationUser loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getUser();

  final MutableIssue issueObject = issueManager.getIssueObject(comment.getIssueId());

  if(!permissionManager.hasPermission(ProjectPermissions.ADD_COMMENTS, issueObject, loggedInUser)) {
  return Response.status(Response.Status.FORBIDDEN).entity("No Permission").build();
  }

  final Comment newComment = commentManager.create(issueObject, loggedInUser, StringEscapeUtils.unescapeHtml4(comment.getCommentBody().replaceAll("\\n","\n")), true);

  final ThreadedComments commentInfo = ao.create(ThreadedComments.class);

  commentInfo.setAuthor(loggedInUser.toString());
  commentInfo.setCommentBody(comment.getCommentBody());
  commentInfo.setCommentId(newComment.getId());
  commentInfo.setParentCommentId(comment.getParentCommentId());
  commentInfo.setIssueId(comment.getIssueId());
  commentInfo.save();

  comment.setCommentId(newComment.getId());

  return Response.ok(comment).build();
}

我已经把日志打印到 final ThreadedComments commentInfo ,并在这行之后给出错误。
我不知道是否还有其他需要的信息,但如果你能帮忙我会很高兴的。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题