Hi,
I have a table of the following format:
Device
---------
id (bigint)
parent (bigint)
address (varchar)
In our model, a device may have a single parent. I want to create a custom user type called DeviceAddress that consists of the device address field and the parent's address field. Is this possible? Does this make sense?
I know I could get the information after the object is loaded, but I would like to do it with Hibernate.
It looks like I have to use a CompositeUserType if it is possible, but I am little confused about how I would specify the property names to get both the parent and the address or if this is even needed.
In a modified form for informational purposes, I want:
<property name="deviceAddress" type="DeviceAddress">
<column name="address"/>
<column name="parent.address"/>
</property>
I considered using
<property name="deviceAddress" type="DeviceAddress">
<column name="address"/>
<column name="parent"/>
</property>
to get the information I want, but this doesn't seem to "fit" what I am really trying to do. Maybe it works and semantically it isn't correct.
Any help would be greatly appreciated.
I am using Hibernate 2.1.4, but will be migrating to 2.1.6 very shortly on a MySQL database. Thank you.
chuck
|