cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: @SortWeight annotation
Date Wed, 13 Jul 2011 16:27:07 GMT
Well, right now we are on 3.0.2, but I might play with 3.1 and try it
out soon.  My first order of business is to try to create a smaller
debuggable test case (that I can reproduce -- the graph issues have
not been easily reproducible).

On inserts we sometimes get:

Can't extract a master key. Missing key (cem_ID), master ID
(<ObjectId:Manufacturer, TEMP:0000CFC6F638DD35>)

On deletes we sometimes get the cycles found exception.

I think part of the problem is using auto-generated keys in MySQL (at
least on insert), but I have more exploring to do.

Thanks,

mrg


On Wed, Jul 13, 2011 at 12:19 PM, Andrus Adamchik
<andrus@objectstyle.org> wrote:
> I am not that well familiar with the AshwoodEntitySorter code, but I guess we'll need
to look at the specific mapping and objects participating in commit to see what condition
triggers it and to take further action.
>
> @SortWeight may help (unless the cycle is between the objects of the same type). You
will need to install WeightedAshwoodEntitySorter in the DI container to take advantage of
it.
>
> Andrus
>
> On Jul 13, 2011, at 4:30 PM, Michael Gentry wrote:
>
>> Hi Andrus,
>>
>> We sometimes get this exception:
>>
>> Sorting objects for [entity] failed. Cycles found.
>>
>> This is obviously coming out of AshwoodEntitySorter.java.  Do you
>> think the annotation would help in that circumstance?  I'm just now
>> starting to investigate this and another graph issue we are having.
>>
>> Thanks,
>>
>> mrg
>>
>>
>> On Fri, Mar 25, 2011 at 3:48 AM, Andrus Adamchik <andrus@objectstyle.org> wrote:
>>> 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.
>>>
>>> Andrus
>>>
>>>
>>> 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: https://issues.apache.org/jira/browse/CAY-1553
>>>>>>           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: http://www.atlassian.com/software/jira
>>>>>>
>>>>>
>>>>
>>>> --
>>>> -------------------------->
>>>> Aristedes Maniatis
>>>> GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
>>>>
>>>
>>>
>>
>
>

Mime
View raw message