Implementing tagging in JDO
Posted
by Julie Paltrow
on Stack Overflow
See other posts from Stack Overflow
or by Julie Paltrow
Published on 2010-05-20T07:09:03Z
Indexed on
2010/05/20
7:20 UTC
Read the original article
Hit count: 302
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
© Stack Overflow or respective owner