My web application (MonoRail, Windsor, ActiveRecord) has a Startable import service and one or more Startable import readers. When, for example, a file is dropped in a directory, a reader parses the file, passes the data to the service, which updates and/or creates objects through repositories. The problem I have is that these Startable services live outside the request scope (where there's a SessionScope from Begin to End), so when the service encounters a lazy collection, there's no SessionScope around to help it do its magic. Cue LazyInitializationException :).
Any ideas how to solve this nicely? Perhaps using an interceptor to create and dispose a SessionScope around the method that processes the data? Equip the repositories with methods that perform eager fetching? I want to keep the services unaware of ActiveRecord, because my dependency paranoia says we might want to use a different persistence mechanism one day.