Avoiding database operations during onActivate() phase is pretty obvious, but it's not applicable here, because we need to handle database object instantiation result (at least). As a simple example, if user doesn't have access to an object requested, we need to redirect him to a login page. We cannot do that past onActivate(), because all component rendering methods cannot return anything besides true or false.
We might have (and in this particular situation we do have) even more complicated situations, when we need to proceed with normal rendering, or return Link instance to redirect user somewhere else, or even send StreamResponse, depending on database instantiation result. On Sun, May 18, 2014 at 11:27 AM, Geoff Callender < geoff.callender.jumpst...@gmail.com> wrote: > That's why I advise the following: > > > http://jumpstart.doublenegative.com.au/jumpstart7/examples/navigation/onactivateandonpassivate/3 > > HTH, > > Geoff > > On 8 May 2014, at 10:33 pm, Ilya Obshadko <ilya.obsha...@gmail.com> wrote: > > > It turns out that running an event handler (onProvideCompletionsFromXXXX) > > in the same component/page may result in various race condition problems. > > > > Suppose you have a complex form and data initialization occurs during > > onActivate phase. Then, this initialization is going to happen every time > > onProvideCompletions handler is called. If this initialization involves > for > > example Hibernate objects loading, in several situations I get 'session > is > > closed' errors (in fact this is very unpredictable - the same operation > > under same conditions may either work normally or fail). > > > > Are there any suggested methods to make autocomplete data source totally > > independent from current component? > > > > -- > > Ilya Obshadko > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Ilya Obshadko