You have to map PersonAddress to do that. You can map it as a standalone entity, but I've always thought that a bit over the top. Define it as a named composite element.
If count is a list index (that is, each person gets its own sequence of count) then you can define the mapping as a simple many-to-many using the <list> collection, instead of <set>. This means that you don't have to map PersonAddress explicitly.
If count is unique for all rows in Person_Address, then you can define it to be part of a composite key of a fully mapped PersonAddress entity: that makes for a more complex mapping, but means that hibernate can look after generating the value in the column.
If neither of those options applies, go with the composite element mapping.
_________________ Code tags are your friend. Know them and use them.
|