[Seaside] How to add GLORP to a Seaside application?
mjl at laubach.at
Mon Jan 31 01:12:33 CET 2005
> I don't really understand what you're trying to do there but the
> glorp usage looks like this
> 1) setup the connection to db, the result is initialized glorpSession
> do this when the app starts/on first client connect)
> 2) on opening an editor (editor=anything that changes objects in a way
> that should be stored in db) on object anObject
> self glorpSession beginUnitOfWork.
> self glorpSession register: anObject.
> 3) change anObject or objects referenced from it
> 4) closing the editor
> on save "self glorpSession commitUnitOfWork"
> on cancel "self glorpSession rollbackUnitOfWork"
> 5) repeat steps 2-4
> 6) clean-up on app exit
Ah, now we are getting somewhere, this clears things up. The tricky
part is where to do all of those things in a Seaside application.
Let's say I have a user list in a table in the database, I want to
display a list of users and a link next to each one, to reset the
to some known value. So I end up with something along the lines of:
[(s readManyOf: User) do:
[html text: ea username.
html anchorWithAction: [ea password: 'xxx'. glorpSession
commitUnitOfWork. glorpSession beginUnitOfWork. ]
text: 'reset pw']]].
I need the commitUnitOfWork/beginUnitOfWork pair so the component will
continue to work as expected after one has set one password.
Does this sound reasonable or am completly off base?
More information about the Seaside