Created
July 6, 2011 12:51
-
-
Save katta/1067150 to your computer and use it in GitHub Desktop.
CouchDB_Example_BlogPostWithComment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TypeDiscriminator("doc.documentType == 'BlogPost'") | |
public class BlogPost extends CouchEntity { | |
private String name; | |
@DocumentReferences(backReference="blogPostId", fetch = FetchType.EAGER, cascade = CascadeType.ALL) | |
private Set<Comment> comments = new HashSet<Comment>(); | |
/* getters and setters */ | |
public void addComment(Comment comment) { | |
comment.setBlogPostId(this.getId()); | |
comments.add(comment); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment