Hello.
Over a year ago I wrote about how to map a many-to-many relationship that had an attribute in the link table. It was a painful experience. I wound up doing it all by hand. XDoclet wouldn't generate my tables correctly so I hand-hacked my mapping files. And I couldn't find a way to tell Hibernate to deal with the attribute so I had to create a class in my model that represented the link. Essentially instead of a many-to-many relation between
A and
B I made a new class,
AB, that had a one-to-many with both A and B. I didn't like the solution because it didn't seem elegant and it most certainly wasn't easy.
Here (
http://forum.hibernate.org/viewtopic.php?t=958613&highlight) is the old post.)
Now I am doing a new project and it has a bunch of tables like the one discussed in that post. Since over a year had passed I thought surely there must be a way to do this ... with Annotations. But it seems there isn't.
Without specifically asking how to do this, can anyone confirm that the ONLY way to do it is to have an intermediate composite element, including a class in the model to represent it? That way I won't waste my time searching for a more elegant and less-intrusive solution in vain.
And of course if there IS an annotation-oriented solution, I wouldn't mind knowing what it is!
FYI, an example relation is the following:
Request
id
description
Person
id
name
PersonRequest
idPerson
idRequest
date
Many thank in advance,
Bob