I am trying to map a key in xml as follows:
<composite-id>
<key-property name="userId" column="USER_ID" />
<key-property name="passwordsBack" column="PASSWORDS_BACK" />
</composite-id>
I have seen this construction, without class="BlahPK", in the documentation, in "Hibernate in Action," and elsewhere. When I try to fetch, though, I get:
Initial SessionFactory creation failed.org.hibernate.MappingException: composite-id class must implement Serializable: MyClass
This is a very simple data class, it's not mutable, I don't need a key and certainly don't want to remodel my object and define a separate public class just to read it with Hibernate. Currently, I have it kludged to use rowid as the id, but I'd rather have the mapping cleanly reflect how the table and object are used.
Disclaimer: I searched StackOverflow and all I found was how to handle composite key hibernate, which just says "don't do it but you can."