On 5/4/06, Ashley Aitken <[EMAIL PROTECTED]> wrote:

Howdy All,

I've been reading more about Wicket, particularly its integration with non-presentation aspects of an Enterprise application, e.g. the application and persistence layers.  

I've read about the Wicket-Spring integration, and the LazyInitProxy - where a Wicket session keeps an injected proxy to any dependencies(?).

first lets clarify some things. the top container of components in wicket is the page. session keeps references to x number of pages for callbacks and backbutton support. so these are only serialized when replication of the session occurs.

components also have models. when the user calls setModelObject() 2nd+ time we clone the model by serialization so that we can version it.

so these are the two places where we do serialization.

the lazy init proxies can be used as a reference either in a component or in a model and not cause any problems when serialized because they have a small footprint. what they let you avoid is serializing your ejb/spring beans because those a) are not serializable b) are most of the time very large c) need to be singletons
 
  I can see mostly how this works.  However, although others have proclaimed it so, it doesn't seem that elegant or easy to me.

if you are going to say something like this you can at least tell us which part of it does nto seem elegant or easy.

here is how you would inject two spring beans into some panel you have:

public class MyPanel extends Panel {
   @SpringBean private UserService userService;
   @SpringBean private BookService bookService;

   public MyPanel() {
      User u=userService.......
   }
}

is that too difficult or too awkward?
wicket is unmanged so there are difficulties that need to be overcome for injection - the biggest one being that injection needs to happen before the object's constructor is run because the dependencies can be used there.


I'm wondering if people think this is a good solution or Wicket needs more work in this area (not being critical, just asking)?   

i think its a good solution - but then again i wrote it :)

I must say I haven't thought much before how sessions would be managed across each request-response loop.  I believe Wicket serialises the session and all the pages cached therein.  

noep, see above


I am just wondering how other frameworks handle this problem and why it seems more difficult in Wicket? Would Wicket fit in well as a Web presentation layer for an application using EJB3 (including JPA)?

i believe Vincent is working with ejb3 so maybe he can tell you about his experience. i think it would be trivial to create an IFieldValueFactory that can inject ejb3 beans instead of spring beans. the contribution would be welcome.

the code can look identical to the spring injection

@EjbBean private UserService userService;

-Igor

Reply via email to