[Seaside] Newbie: GOODS with Seaside

Julian Fitzell julian at beta4.com
Mon Apr 26 18:03:39 CEST 2004

Ruben Bakker wrote:
> I've played with the examples and have created my first very simple seaside application. I've added GOODS to make my domain model persistent.
> I'm unsure if I'm on the right track:
> I have extended WAControllerSession to hold the KKDatabase instance. I'd like to logout the KKDatabase when the WAControllerSession expires. How do I get notified when the session expires? I tried pageExpired and expire, but they didn't get called. Or should I manage the KKDatabase instantiation and logout for each request? Does there exist a pooling functionality so the overhead creating/destroying KKDatabases could be minimized?

I haven't used GOODS in smalltalk yet, but you seem to have the right 
idea.  The #expire method is only used if you want to manually expire a 
session, though.  And #pageExpired gets called when you visit a page 
that is no longer in the cache.

You don't say what version of Seaside you're using but I'm guessing it's 
2.3.  I've merged into the current 2.5 alpha release a hook that we 
added at work that gets called when a session gets expired.  If you want 
to add this yourself in 2.3, take a look at 
WARegistry>>collectExpiredHandlers.  If you're playing with 2.5a, you 
can implement #unregistered on your session class.

That said, you can have a lot of sessions hanging around for quite a 
while in a large application.  I don't know if GOODS comes with a 
connection pool but it's probably very easy to write one.  I wrote one 
for OmniBase using a SharedQueue and maybe a half-dozen methods.  It 
really does make things so much simpler and way more efficient in terms 
of the number of database connections around at any point.


More information about the Seaside mailing list