Hi,
I have a table where the primary key is three columns. In Java, the primary key object has two properties: a Long, and an object which in turn has another Long and an Integer as properties.
I'm confused as to how to map this in Hibernate. I tried creating a UserType for all three fields, but I wasn't able to create a valid mapping.
I think that what I need to do is create two CompositeUserTypes, one for the smaller object and another that includes the smaller object.
Is this possible in Hibernate? Can one of the fields of a CompositeUserType be another CompositeUserType? How do I represent this?
Assuming I can pull it off, can I use the whole thing as an id?
Is there a better way to handle this situation?
Obviously I could expose all the properties of the nested object as properties of the primary key object, but that seems inelegant.
|