*shrug* that's what I've been doing thus far. But I don't think it's so
special... I find myself writing helper methods quite a bit. :)
As you point out, cayenne can't guess the correct key. But as a
developer, you know what things are (should be) unique. I'm not
suggesting that all to-many relationships be expressed as maps; I just
think it would be nice if cayenne allowed the flexibility to specify the
relationship as a map, and managed appropriate (lazy) faulting of
objects, expiring stale objects, etc.
Robert
Juergen Saar wrote:
> I think this is a little special ...
>
> if you have 1..n relation to addresses this could make sense, but for a
> relation order to positions this would be difficult. The only way cayenne
> could provide a generell map is the PK an I don't think that this
> would be
> helpful. All other attributes are nor secured unique ...
>
> I think for the few cases where this makes sense, I would write a little
> helper method.
>
> --- Juergen ---
>
>
>
> 2007/1/16, Robert Zeigler <robert..uregumption.com>:
>>
>> Currently (to the best of my knowledge), cayenne always represents a
>> to-many relationship as a java.util.List. However, I was thinking it
>> would be nifty if cayenne supported map-representations of to-many
>> relationships. For instance, you could model a relationship between
>> Users and UserPreferences as a map, and specify the "name" property of
>> the UserPreferences table as the map key. Does that make sense? Am I
>> the only one who thinks that would be incredibly useful? :) Is something
>> like this already planned for 3.0?
>> If other people would find it useful, then I'd be happy to submit a
>> feature request and also work up a patch.
>>
>> Robert
>>
>
This archive was generated by hypermail 2.0.0 : Tue Jan 16 2007 - 03:57:10 EST