Is it possible to use a SSB with a DataModel.  It's funny that the examples in 
the books and the JBoss web site use a SFSB and then say it's not a good idea 
to use SFSB with Seam.  The problem I have with SSB is that the data is often 
stale.  If you modify it in another SB (or even the same SB) and then return to 
the page it is showing the stale data.  There has to be a way to do this 
without using SFSB or resorting to using a conversation.  I can do this with 
straight JSF easily.

Your help is GREATLY appreciated!

Here is my SFSB:

@Stateful
@Scope(ScopeType.SESSION)
@Name("inventoryAction")
public class InventoryActionImpl implements Serializable, InventoryAction {

        Logger log = Logger.getLogger(InventoryActionImpl.class);

        @DataModel
        private List inventory;

        @DataModelSelection
        @Out(required = false)
        private Car car;

        @PersistenceContext(type = PersistenceContextType.EXTENDED)
        private EntityManager em;

        @Factory(value = "inventory")
        public void fetchInventory() {
                CarDAO carDAO = new JPACarDAO(em);
                inventory = carDAO.filterByStatus(Car.STATUS_AVAILABLE);
        }

        public String buy() {
                return "buy_car_admin";
        }

        public String edit() {
                return "edit_car_info";
        }

        public String createNew() {
                car = new Car();
                return "add_car";
        }

        public String deleteInventory() {

                List toBeDeleted = new ArrayList();

                for (Car car : inventory) {
                        if (car.isSelected()) {
                                toBeDeleted.add(car);
                        }
                }

                // delete from database
                CarDAO carDAO = new JPACarDAO(em);
                carDAO.delete(toBeDeleted);

                // refresh cached inventory (seems to work) 
                // but I'm screwed if another SB updates the data
                fetchInventory();

                return null;
        }

        @Remove
        @Destroy
        public void destroy() {
        }

}


Thanks,

Scott



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

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

Reply via email to