-->
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: UserType containing a collection
PostPosted: Mon Jan 18, 2010 5:34 am 
Newbie

Joined: Mon Sep 26, 2005 5:47 am
Posts: 4
Hi,

I have mapped a User entity containing an Address, mapped as a UserType instead of a component (what you would normally do).

Code:
<class name="User" table="Entity" >
        <id .../>
        <property name="address" type="AddresUserType">
                <column name="street"/>
                <column name="city"/>
        </property>
        ...
</class>

The AddressUserType implements CompositeUserType. This works just fine.

However, now I want to add a collection of telephone nr's inside the Address class. Something like the following although the following mapping is just not possible of course.
Code:
<class name="User" table="Entity" >
        <id .../>
        <property name="address" type="AddresUserType">
                <column name="street"/>
                <column name="city"/>
                <set name="telephonenrs">
                ...
                </set>
        </property>
        ...
</class>


How can I map this, still using the UserType?
In the nullSafeGet and nullSafeSet of the AddressUserType I need to get the collection of telephone nr's linked to that Address/User. What's the best way to do this and does a similar example exist?

Thanks
Jan


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.