Hi John, If the key column in the USERPROPERTIES table holds unique values per User (i.e., a given user would never have more than one record in the USERPROPERTIES table with the same key), then I'd define the UserProperty collection as a struct instead of an array, and you could then use the natively generated Transfer method getUserProperty(key) to retrieve the UserProperty object by key.
I'm not sure I understand what you're going to do with your MapFactoryBean in your decorator, but in terms of injecting it into your decorators, you just need to use Brian Kotek's TDOBeanInjectorObserver (found at http://coldspringutils.riaforge.org/). It comes with instructions for setting it up, and I also wrote a post awhile ago (http://www.silverwareconsulting.com/index.cfm/2008/11/24/How-I-Use-Transfer-Today--A-Gateway-MapFactoryBean) which specifically addresses injecting a MapFactoryBean into Transfer decorators. Cheers, Bob On Tue, Mar 10, 2009 at 8:50 AM, John Whish <john.wh...@googlemail.com> 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 :) > > > -- Bob Silverberg www.silverwareconsulting.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 transfer-dev@googlegroups.com To unsubscribe from this group, send email to transfer-dev-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~----------~----~----~----~------~----~------~--~---