[Seaside] Seaside, Omnibase, OmnibaseSupport - markDirty failing
Wilkes Joiner
wilkesjoiner at gmail.com
Mon Feb 20 16:35:09 UTC 2006
On 2/20/06, Dmitry Dorofeev <dima-sender-3c337a at yasp.com> wrote:
> Hi,
>
> Glad to see you managed to get it sorted, but still would say that
> you didn't get 100% clue how it works :-)
Certainly not a 100%, but I getting closer ;)
> see below.
>
> Wilkes Joiner wrote:
> >
> >
> > I got this working. I learned a couple of things. Executing the
> > following raises "ODBError: Object is not persistent or is a part of
> > composite persistent object"
> >
> > |postRef|
> > postRef := nil.
> >
> > BLGDatabase current execute:
> > [postRef := BLGPost new asPersistentReference].
> >
> > BLGDatabase current execute:
> > [postRef title: 't1'; body: 'b1'; markDirty]
Above is what I was originally trying to do by using a single
component for creates and edits.
> > However this does not:
> > |postRef|
> > postRef := nil.
> >
> > BLGDatabase current execute:
> > [postRef := BLGPost new asPersistentReference].
>
> You can safely leave it as
>
> BLGDatabase current execute:
> [postRef := BLGPost new].
>
> or even
> postRef := BLGPost new
> as here is no OmniBase operations at all.
>
>
> >
> > BLGDatabase current execute:
> > [postRef title: 't1'; body: 'b1'; makePersistent; markDirty]
>
> finally it is the same as
> BLGDatabase current execute:
> [BGLPost new title: 't1'; body: 'b1'; makePersistent]
>
> You don't need to markDirty on objects which just made Persistent ;-)
> this will work as well:
>
> BLGDatabase current execute: [
> post := BGLPost new.
> post makePersistent.
> post title: 't1'; body: 'b1'.
> ]
Correct, but I'm using as subclass of ODBSSession which wraps every
request inside a transaction. I was just trying to mimic that
behavior in a workspace, and discover why markDirty fails on a
persistent object that spans multiple transactions.
> >
> > Since my component answers with a new Post, I just broke it up into a
> > create component and an edit component. The method that calls the
> > create sends the makePersistent to the Post before adding it to the
> > persistent OrderedCollection.
> >
> > BLGPostList>>newPost
> > | post |
> "hope you don't use transactions and omnibase calls in BLGCreatePost component
> -Dmitry."
> > post := self call: (BLGCreatePost new).
> > post makePersistent.
> > self listing
> > add: post;
> > markDirty.
Since using ODBSSession puts every request inside an Omnibase
transaction, I am. But as I gain a better understanding of how
Omnibase and OmnibaseSupport work, I don't think it will be a problem,
but that is a naive assumption at this point.
Thanks,
Wilkes
More information about the Seaside
mailing list