cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: @SortWeight annotation
Date Fri, 25 Mar 2011 07:48:16 GMT
You can already override the sorter via DI (and create a chain yourself, decorated as EntitySorter
interface). The sorter has the same scope as Cayenne stack, although I guess internal implementation
can be done as dynamic strategy based on contextual parameters. 

Suggested annotation is a way to attach a per-entity piece of configuration that can be used
by the sorter. Due to the nature of the annotations it will also have a stack lifetime scope.


On Mar 25, 2011, at 1:03 AM, Aristedes Maniatis wrote:

> How pluggable is the sorter? Could a user specify a different sorter for one particular
commit? Or for a whole context? Or chain the sorters so that Ashwood is used first and then
another sorter is used to adjust the results under particular circumstances?
> Ari
> On 25/03/11 5:00 AM, Andrus Adamchik wrote:
>> Here is an algorithm analysis task for graph-theory-minded folks. I came up with
the @SortWeight solution below for a very specific problem when commit operation ordering
can not be derived from the cross-entity relationships in the DataMap. Now I wondering how
many other cases raised on this list that are not addressed by the default AshwoodEntitySorter
can be solved by manually overriding entities ordering "weight"?
>> Andrus
>> On Mar 24, 2011, at 4:50 PM, Andrus Adamchik (JIRA) wrote:
>>> cayenne-lifecycle: @SortWeight annotation
>>> ------------------------------------------
>>>                Key: CAY-1553
>>>                URL:
>>>            Project: Cayenne
>>>         Issue Type: Task
>>>         Components: Lifecycle Extensions
>>>   Affects Versions: 3.1M2
>>>           Reporter: Andrus Adamchik
>>>           Assignee: Andrus Adamchik
>>> Sometimes it is useful to manually override the operation ordering for some entities.
E.g. per CAY-1547 we support UuidRelationships, but saving an object with a UuidRelationship
to another object does not generate correct ordering. So we may want to override default ordering
for entities annotated with @UuidRelationship. E.g.:
>>> @SortWeight(1.1)
>>> @UuidRelationship("UUID")
>>> class My extends _My {}
>>> Note that this approach will not be able to address all shortcomings of a generic
AshwoodEntitySorter. It is somewhat of a hack. So it will be placed in cayenne-lifecycle and
treated as an "extension".
>>> --
>>> This message is automatically generated by JIRA.
>>> For more information on JIRA, see:
> -- 
> -------------------------->
> Aristedes Maniatis
> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message