elt means element. If you have a primary key [softwareId, username], all foreign keys referring to it must be exactly the same.
In your Software mapping, you're describing a Purchase as a composite element. Then you define a Purchase mapping. Have you read the reference documentation? You're not even close to the examples in there. You
never want to define a class and a composite element describing the same thing.
I'm still not exactly sure of the relationships that you want, but here's a guess. One Software instance can have many Purchases, so you want a <set> containing a <one-to-many>. The <key> in a <set> describes the columns in the contained table that are the foreign key back to the containing table. So in Software, you want something like
Code:
<set table="tr_purchase" name="purchases" inverse="true">
<key column="softwareId"/>
<one-to-many class="Purchase">
</set>
You want a bidirectional mapping. So in Purchase, you need a many-to-one back to Software. Because you can't use a column twice in the same mapping, and softwareId is already defined as part of the key, you have to use a formula for the mapping. So in Purchase, put something like this:
Code:
<many-to-one name="software" formula="softwareId" class="Software"/>
A Purchase refers to one User, suggesting a one-to-one mapping, but in hibernate, one-to-one means that both tables use the same primary key. So what you want is a unique one-to-many. In Purchase, put something like this:
Code:
<one-to-many name="user" class="User" unique="true"/>
And apparently you don't want a bidirectional mapping in this case, so User doesn't need any mapping to Purchase.
Give all that a go, and if it doesn't help, describe in a bit more detail how you want the relationships to go.