I have a search component which is event scoped.  Itself it just has four 
properties which are bound to four input fields in my JSF page.

It extends a generic search component which has a hibernate session which is 
injected by the @In( create = true ) from the ManagedHibernateSession 
component.  This generic component has bindings to a couple of the controls on 
the JSF page (grid/parameter panel etc).

The search renders fine when it is visited the first time, including some db 
queries to get some meta-information.   On clicking the search button which 
posts back the @In injection of the Session fails because the bijection gets 
fired when binding the UI components to the search object.  This happens during 
the restore view phase when the conversation scope is not available and 
therefore neither is the hibernate session.

I get the feeling I'm just not using it right but I'm not sure why.  Is 
injecting conversation scoped components into event scoped components something 
that shouldn't/can't be done?  Or do I have my components badly designed.

I've posted the highlights of the classes here..

The component


  | @Name( "elementSearch" )
  | @Scope( ScopeType.EVENT )
  | public class ElementSearch extends SparkSearch
  | {
  |     // control value bindings
  |     private String eltName;
  |     private Integer elementSet;
  |     private Integer country;
  |     private String eltDigits;
  | 
  |     public String getEltName()
  |     {
  |         return eltName;
  |     }
  | 
  |     // ... more getters/setters here
  | 


  | public abstract class SparkSearch
  | {
  |     private UIData dataGrid;
  |     private HtmlPanelGrid parameterGrid;
  | 
  |     @In( create = true )
  |     private Session referenceSession;
  | 
  |     @In( required = true )
  |     private SessionFactory referenceSessionFactory;
  | 
  |     public HtmlPanelGrid getParameterGrid()
  |     {
  |         return parameterGrid;
  |     }
  | 
  |     public void setParameterGrid( HtmlPanelGrid parameterGrid )
  |     {
  |         // this gets called during the restore-view phase at which point 
the bijection fails on the referenceSession
  |         this.parameterGrid = parameterGrid;
  |     }
  | 
  |     // .. more getters/setters here + action methods
  | 

Any comments appreciated.

Cheers.

Mike.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993288#3993288

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993288
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to