I'm an RIA Developer who owns a motorcycle custom paint shop, who loves to race anything with wheels. I also enjoy woodworking, cooking, fine wines, liqueurs and dark beers. So if nothing else my blog should be eclectic.  

Category: Transfer

Jun 16 2008

Transfer: <property> and <manytoone> don't play well together

Last week I started a new project and I decided to use Transfer-ORM. So far I've been happy with it's offerings aside from one severe headach my limited knowledge on the product has created. In my database I have multiple depths of linking, I would like to leverage the <manytoone> ability of Transfer, howevere I also need to use these same fields in a readByPropertyMap call.

My goal is to be able to use eventId as a property while being able to "getEvent()" and get back a transfer object. The Issue: You can't have the same a column in your config as is the link column in a <manytoone>. Transfer is nice enough to create the supporting methods for your linked tables/objects, but fails to give you a convenient way to "filter" by them. I feel this is an utmost basic use of object based design but I could be wrong.

The "Solution":
<object name="ObjectName" table="tblName">
    <id name="sessionId" type="numeric" generate="false" />
    <property name="eventIdLink" column="eventId" type="numeric" ignore-insert="true" />

    <manytoone name="Event">
        <link to="events.Event" column="eventId"/>
    </manytoone>
</object>

  1. I appended "Link" to my property name. This is how it needs to be referenced in the readByPropertyMap()
  2. Added ignore-insert="true" to my properties
  3. renamed my nodes to the Object of what is returned.

I really think that if I should be ably to have a <property> named eventId and a <manytoone> named event on column eventId and have the app just know not to try and build 2 setEventId methods. Hopefully this will save someone else a few minutes time in their playing with Transfer...

 

2 comments - Posted by Russell Brown at 11:31 PM - Categories: ColdFusion | Development | Transfer

Categories

Monthly Archives

Tech Blogs I Read

Motorcycle Links