I am implementing a tagging system for a website that uses JDO . I would like to use this method.
However I am new to relationships in JDO. To keep it simple, what I have looks like this:
@PersistentCapable
class Post {
@Persistent String title;
@Persistent String body;
}
@PersistentCapable
class Tag {
@Persistent String name;
}
What kind of JDO relationships do I need and how to implement them? I want to be able to list all Tag
s that belong to a Post
, and also be able to list all Post
s that have a given Tag
. So in the end I would like to have something like this:
Table: Post
Columns: PostID, Title, Body
Table: Tag
Columns: TagID, name
Table: PostTag
Columns: PostID, TagID