[Seaside] Seaside, Omnibase, OmnibaseSupport - markDirty failing
dima-sender-3c337a at yasp.com
Sun Feb 19 19:25:25 UTC 2006
I have played with OmnibaseSupport and got it to work with some pain.
Shortly it requires quite serious planning how you store and fetch
objects from OmniBase.
1. you should understand that ODBSSession creates separate omnibase
transaction for EACH HTTP request and commit it
automatically. That may result in surprises when you fetch data from
omnibase in one HTTP request, but try to update it (markDirty) in
That means that you commit object which is alien for current omnibase
2. To avoid surprises EVERY saved object in omnibase (which was sent
markPersistent) must be derived from ODBSPersistentObject AND
every time you fetch object from omnibase add asPersistenceReference.
posts := (OmniBase root at: #BLGPost) asPersistenceReference.
let's say we have an OrderedCollection (persistent) stored in
OmniBase at 'col' key.
Our collection contains persistent objects.
objs := (OmniBase root at: 'col') "WRONG"
objs := (OmniBase root at: 'col') asPersistentReference "May be
Wrong, as markDirty sent to elements later may result in troubles"
objs := (OmniBase root at: 'col') values do: [:v| v
asPersistentReference] "Ok to markDirty any obj, but we can not alter
the collection anymore :-("
Seems we need special collections to support persistence references
provided by omnisupport
or probably it is something i missed in the package ?
Hope my post saves you hours of debugging :-)
Also consider to use alternative approach: "One OmniBase transaction
per Seaside session".
You can do it without OmniSupport staff, but you need to use checkout
instead of commit, and do manual unlock of object marked dirty
after checkout. So I feel there is no easy way to do OmniBase +
Is my experience deserve an article about OmniBase strategies with
Seaside to be published ?
On 19.02.2006, at 17:37, Wilkes Joiner wrote:
> I'm learning to use Seaside with Omnibase and am having some issues.
> I'm getting a "ODBError: Object is not persistent or is a part of
> composite persistent object" when calling markDirty on an object.
> Here is the setup for the app.
> I'm using a custom Session class, BLGSession, which is a subclass of
> I have one domain object, BLGPost, and two components. One for
> listing posts, BLGPostList, and another for creating and editing them,
> BLGPost inherits from ODBSPersistentObject. It has a body attribute
> with the following setter:
> BLGPost>>body: anObject
> body := anObject.
> self markDirty.
> The edit component is causing the problem. When I call it to modify
> the body attribute of a Post I get the "not persistent" message.
> ^ post isNil
> ifTrue: [post := BLGPost new]
> ifFalse: [post]
> BLGPostEdit>>renderContentOn: html
> html form:
> [html paragraph:
> [html label for: 'post_title'; with: 'Title'.
> html break.
> html textInput on: #title of: self post].
> html paragraph:
> [html label for: 'post_body'; with: 'Body'.
> html break.
> html textArea on: #body of: self post].
> html submitButton callback: [self answer: self post]].
> I've tried many variations and permutations of this, but can't seem to
> get this to work. Anything obvious that I'm missing? Is my approach
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the Seaside