* @throws PhotoAlbumException
*/
public void addComment(Comment comment) throws PhotoAlbumException {
Image image = comment.getImage();
if (!image.isAllowComments()) {
throw new PhotoAlbumException("Cannot add comments to this image");
}
try {
image.addComment(comment);
em.persist(comment);
em.flush();
} catch (Exception e) {
throw new PhotoAlbumException(e.getMessage());
}
}