Try putting the key-field on the software-belongs-to-packageitems side since the id belongs to that side of the relationship.
You should definitely check out chapter 7 of the book to learn how to configure persistence. We have a very similar example and offer this as simple explanation:
[code]
In
JBoss, key fields for relationships are always defined on the
source side of the relationship, regardless of whether they are mapped as
foreign keys in another entity table or in a middle table. Although it may
seem slightly odd in this particular case, JBoss is very consistent.
It's slightly out of context, but I think it should make sense.