[Seaside] How to add GLORP to a Seaside application?

Martin J.Laubach mjl at laubach.at
Sun Jan 30 17:48:36 CET 2005

   While trying to build a simple database based application with 
Seaside, I tripped
over the question how to do it so it would work as intended. I'm trying 
to do it
with GLORP, and the following problems arose:

   In my main task do something like:

   Problem #1:

		self call: mySubComponent.

   If the user goes out for a coffee or closes his browser never to 
return, the
database connection stays open until, well, basically hell freezes 
over. Not good,
there are only that many connections possible. I probably need 
something that gets
executed as soon as the session times out. Wrapping the whole thing 
with #ensure:
does not seem to do the right thing, the ensure block is executed all 
the time, not
just when the #call: returns.

   Problem #2:

	MySubComponent>>renderContentOn: html
		| t |
		db transact: [
			t := readObjectFromDatabase.
			html anchorWithAction: [ t setSomeField: 'somevalue' ].
			self commitTransaction ]

   This quite obviously can't work, since the callback is invoked when 
transaction is already committed. When no transaction is in progress, 
seems no to care for instanciated objects any more, so any change is 

   I arrived at a workaround that looks like

	MySubComponent>>renderContentOn: html
		| t |
		t := readObjectFromDatabase.
		html anchorWithAction: [ db transact:
			[ db refresh: t. t setSomeField: 'somevalue' ]].

   but that looks as if it will totally destroy performance and also 
makes the
whole exercise of using GLORP in the first place rather pointless -- 
when I
have to re-register all objects with the database layer manually, I 
might as
well scribble manually to the database, avoiding GLORP alltogether.

   Are there any examples out there how to use glorp and Seaside 
Or perhaps GLORP is the wrong thing to look at and it's completely 



More information about the Seaside mailing list