I am struggling with a relation which looks like this:
- CMP 2.0
id: pk field
name: name of the user
... and other fields ...
Bookmark of a User (Bookmark Bean):
user_id: is the primary key of the user (User.id)
url: a url which the user wants to bookmark
description: description of the url
Since it doesn't make sence, that a User has duplicate bookmarks (bookmarks with the same urls). I created a composite pk with (user_id, url). So a Users Bookmarks will always be distinct in the "url"
Now I want to set a relation between the User and the Bookmark, so I can do something like this:
Collection collection = user.getBookmarks();
when I set the relation fields and columns in jbosscmp-jdbc.xml, I thought I only have to describe the relation between "User.id" and "Bookmark.user_id" (foreign-key-mapping). But since Bookmark has a composite pk the Deployer always wants me to specifiy the "url" field as well. Why is this neccessary? If I do specify the "url" field, JBoss creates another table to map the "User.id" field to the composite pk. This doesn't look very efficient to me, because the relation should be clear without that extra table (at least for me) ...
Is there a way to set the relation in a different way?
Sorry to bother all of you,
finally I got it to work. I gave up editing xdoclet tags and edited the jbosscmp-jdbc.xml manually and there it is ... it is working?! At least the deployer doesn't complain anymore.