Re: Beginner question about JDO best practice



On 20 Dez., 16:02, Dyreatn...@xxxxxxx wrote:

But presumably the 'name' column is declared 'UNIQUE' for a reason?
Allowing you to just add tag3 would violate the unique-ness,
wouldn't it? If you don't really need them to be unique after all,
shouldn't you change the table definition to reflect that?

To simplify matters I didn't explain the whole situation but I guess
this is necessary now:

Let's say we have another class, for example a "BlogEntry" class,
which contains - among other things - a Set of Tag objects. Since
there can be many BlogEntry and Tag instances I want the tags to be
unique in the database scheme. blog entries and tags are related to
each other via a join table which contains the columns "blog_id" and
"tag_id".

What I was hoping for is that JDO automatically handles the uniqueness
of tags when persisting a BlogEntry object with n Tag objects and
inserts the right ids into the join table.
.



Relevant Pages