In our system we have Jobs with multiple Tasks. These Tasks need to be
ordered, so they have a sequence number (sortkey). For example:

Task: "Deliver magazines"
  Job 1: "815 1st street"
  Job 2: "201 1st street"
  Job 3: "900 1st street"

In the example above, we need to order this in the order the jobs have
to be executed. This means that the correct order will be:

Task: "Deliver magazines"
  Job 1: "201 1st street"
  Job 2: "815 1st street"
  Job 3: "900 1st street"

(1 and 2 are switched)

There is a unique index on Job.TaskId, Job.SortKey.

I need to make three mutations to respect this unique index:

  2 => 4 (put it aside)
  3 => 2 (put 3 on the correct position)
  4 => 3 (put the original 2 at the correct position)

The problem is that the last mutation overwrites the first mutation if
I do not flush in between. I do understand CpBT (a little better than
a week ago anyway) and I do see the advantage of not giving the
business logic that kind of control.

However, I do not know how to solve this issue.

On Sep 20, 9:22 pm, Fabio Maulo <[email protected]> wrote:
> Instead talk about records, unique keys and "A" and "B" can you explain
> which is the case with something more closer to real-world OOP.
>
>
>
>
>
> On Mon, Sep 20, 2010 at 4:16 PM, Fabio Maulo <[email protected]> wrote:
> > three mutation of same entity not only in a single UoW but even in a single
> > method and you want three roundtrips ?
> > If so, it is not supported and won't be supported (at least in my line)
>
> > On Mon, Sep 20, 2010 at 4:06 PM, pvginkel <[email protected]> wrote:
>
> >> Wouldn't this still merge the first and third mutation into a single
> >> update? I have looked at uNhAddins, but I can't really figure out
> >> which specific example applies to my situation. If you can direct me
> >> to a specific source file, I would be very happy.
>
> >> To be clear: I would put these three mutations in a single method
> >> which is surrounded by the GetConversationCaregiver (transparent with
> >> AOP, or not)?
>
> >> On Sep 20, 7:03 pm, Gustavo Ringel <[email protected]> wrote:
> >> > Did you check uNhAddins? This is already implemented...and of course it
> >> is
> >> > done with FlushMode.Never...but you don't manage this, this is managed
> >> using
> >> > the [PersistenceConversational] attribute...
>
> >> > Gustavo..
>
> >> > On Mon, Sep 20, 2010 at 6:08 PM, pvginkel <[email protected]> wrote:
> >> > > I'm looking into applying CpBT into my application. On of the things
> >> > > I'm trying to do is set flushmode to never and only commit through
> >> > > explicit flushes. I encounter the following issue when I try to
> >> > > implement this. Btw: this concerns porting a legacy application.
>
> >> > > Certain tables have sequence (order) fields that have a unique index
> >> > > over the sequence fields and the parent ID. When I resequence these, I
> >> > > have to put one record aside temporarily to be able to move the
> >> > > records around correctly.
>
> >> > > So, I have record A with sequence 1, and record B with sequence 2.
> >> > > When I switch them around, I have to move A to 3, B to 1 and then A to
> >> > > 2.
>
> >> > > The problem with this is that if I do not do an explicit flush after
> >> > > the first mutation, the sequence gets overwritten by the last
> >> > > mutation.
>
> >> > > Does anyone have experience with this specific issue (or issues like
> >> > > this) and have a suggestion how I solve this with FlushMode.Never abd
> >> > > CpBT?
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> Groups
> >> > > "nhusers" group.
> >> > > To post to this group, send email to [email protected].
> >> > > To unsubscribe from this group, send email to
> >> > > [email protected]<nhusers%[email protected]
> >> > >  >
> >> <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup
> >>  s.com>>
> >> > > .
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/nhusers?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "nhusers" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]<nhusers%[email protected]
> >>  >
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nhusers?hl=en.
>
> > --
> > Fabio Maulo
>
> --
> Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to