-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: CompositeUserType/UserType help
PostPosted: Tue Oct 12, 2004 5:38 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.