Why not store the user property as a Struct? Mark
On Tue, Mar 10, 2009 at 11:50 PM, John Whish <[email protected]> wrote: > > Hi, hopefully you guys don't mind helping me out on this one. What I'm > trying to do is create a User object which has additional optional > properties stored as a struct/map. I'm just not sure how to do this > with Transfer. This is what I've come up with so far... > > member package definition: > > <package name="member"> > <object name="User" table="USERS" > decorator="com.model.member.User"> > > <id name="UserID" column="user_id" type="GUID" > generate="true" /> > <property name="Firstname" > column="user_firstname" type="string" > nullable="false" /> > <property name="Lastname" > column="user_lastname" type="string" > nullable="false" /> > > <property name="Updated" column="user_updated" > type="date" > nullable="false" /> > <property name="Created" column="user_created" > type="date" > nullable="false" /> > <property name="Username" > column="user_username" type="string" > nullable="false" /> > <property name="Password" > column="user_password" type="string" > nullable="false" /> > <property name="IsActive" column="user_active" > type="boolean" > nullable="false" /> > <property name="IsDeleted" > column="user_deleted" type="boolean" > nullable="false" /> > > <!-- optional --> > <property name="Dob" column="user_dob" > type="date" > nullable="true" /> > <property name="Email" column="user_email" > type="string" > nullable="true" /> > > <!-- compositions --> > <manytoone name="Role" lazy="false"> > <link to="member.Role" > column="role_id" /> > </manytoone> > > <onetomany name="UserProperty" lazy="true" > proxied="true"> > <link column="fk_user_id" > to="member.UserProperty" /> > <collection type="array"> > <order property="Key" > order="asc" /> > </collection> > </onetomany> > > </object> > > <object name="Role" table="ROLES" > decorator="com.model.member.Role"> > <id name="RoleID" column="role_id" > type="numeric" /> > <property name="Name" column="role_name" > type="string" /> > <property name="Description" > column="role_description" > type="string" /> > </object> > > <object name="UserProperty" table="USERPROPERTIES" > decorator="com.model.member.UserProperty"> > <id name="UserPropertyID" column="property_id" > type="numeric" /> > <property name="Key" column="property_name" > type="string" /> > <property name="Value" column="property_value" > type="string" /> > </object> > > </package> > > I intend to add a getProperty() to the User Transfer Decorator which > can retrieve values via the key. Is this the right approach? > > I'd also like to make use of ColdSpring's > coldspring.beans.factory.config.MapFactoryBean to define the key names > as constants. I'm not sure how to go about injecting this into the > Transfer Decorator (as it's Transient). > > As always advice gratefully received. Thanks in advance :) > > > -- E: [email protected] W: www.compoundtheory.com --~--~---------~--~----~------------~-------~--~----~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups "transfer-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~----------~----~----~----~------~----~------~--~---
