2 Replies Latest reply on Feb 29, 2008 11:32 AM by pmuir

    Data Model Problem

    seto.kaibaseto.gmail.com

      To make use of ajax data scroller, data should be with extended data model. But the default @DataModel won't automatically convert. So I use a session bean to extend the extended data model. But I found that the session bean could be only accessed with Local interface. So it can't be cast to SerializableDataModel. But if I changed it into pojo, the class cast exception won't occur. But to be uniform, I should use EJB3. Can someone help me?

        • 1. Re: Data Model Problem
          seto.kaibaseto.gmail.com
          
                              SerializableDataModel dataModel = (SerializableDataModel) getValue("#{userDataModel}");
          
                              assertEquals(dataModel.getRowCount(), 2);
          
          



          It will cause ClassCastException. But my userDataModel is  a session bean extending SerializableDataModel. So I think the problem is the session bean could be only accessed as the Local interface. So it couldn't be cast as SerializableDataModel. When I changed the session bean into POJO. The problem doesn't exist. But to be uniform, all class should be EJB. So any solution to this?

          • 2. Re: Data Model Problem
            pmuir

            Not really, assuming there is no interface that represents your DataModel that the interface can extend. Just use a POJO. Or write your own DataBinder.