Hi everyone,
I’m trying to add threaded comments when pressing the reply button. I want to do that with Active Objects. When I press the button, it normally needs to write to my entity table named AO_C21EEC_THREADED_COMMENTS automatically created in the database. But I got this error:
[common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: There was a SQL exception thrown by the Active Objects library:
Database:
- name:PostgreSQL
- version:9.3.24
- minor version:3
- major version:9
Driver:- name:PostgreSQL Native Driver
- version:PostgreSQL 9.0 JDBC4 (build 801)
org.postgresql.util.PSQLException: ERROR: relation “public.AO_C83514_THREADED_COMMENTS_ID_seq” does not exist
Position: 16
My addComment function is below there:
@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();
}
I’ve printed the logs up to the line starts with ‘final ThreadedComments commentInfo…’ and it gives the error after this line, I guess…
I don’t know if there is any other information needed but I would be glad if you can help.