[jboss-user] [JBoss Seam] - Re: ClassCastException with @DataModel

nhieb do-not-reply at jboss.com
Fri Aug 31 06:29:53 EDT 2007


Get rid of the @Out and put @Factory annotations to the method, that fills this lists. I imagine it is view

  | @Name("viewDocument")
  | @Stateless
  | public class ViewDocumentAction implements ViewDocument {
  | 
  |     @DataModel(value = "alerts")
  |     private List          alerts;
  |     
  |     @DataModelSelection(value="alerts")
  |     private Alert selectedAlert;
  | 
  |     @DataModel(value = "docevents")
  |     private List          docevents;
  |     
  |     @DataModelSelection(value="docevents")
  |     private DocumentEvent selectedEvent;
  | 
  |     @Out
  |     private Document      document;
  | 
  |     @PersistenceContext
  |     private EntityManager em;
  | 
  |     @RequestParameter
  |     private String        documentId;
  | 
  |     @Factory("alerts"")
  |     @Factory("docevents")
  |     public void view() {
  | 
  |         long id = StringUtility.parseLong(documentId);
  | 
  |         document = em.find(Document.class, id);
  | 
  |         if (document != null) {
  |             // fetch alerts and events from db
  |             document.getEvents().size();
  |             document.getAlerts().size();
  | 
  |             alerts = new ArrayList(document.getAlerts());
  |             docevents = new ArrayList(document.getEvents());
  |         }
  | 
  |     }
  | 
  | 
once xhtml page sees need of alerts to be initiated, it will search for it factory method. 

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079922



More information about the jboss-user mailing list