I have written Stateful session bean for Shopping application which maintaines the state of how many items the customer has purchased. But how do i maintain the state when network or db crashes so I should recover the state of my stateful session bean for the items purchased
Originally posted by pradeep anandan: But how do i maintain the state when network or db crashes so I should recover the state of my stateful session bean for the items purchased
First off, most applications are only as reliable as the underlying datasources. This is especially true of ecommerce applications (is it still cool to call them ecommerce?). If your requirements are 24 X 7 operation, even during database downtime, then you need to address this at the database tier thru clustering the fail-over. It is unrealistic to expect the application to continue to work even when the database is out. If this was the case then why even use a database? Secondly, a Stateful Session Bean does not store state in the database nor is it dependent on the network so I don't see where you are going with your question.
Originally posted by aakash bhatt: Hi Chris U r right about the point but if the application server fails can we recover the state of the Stateful session bean till the last succesful transaction. Regards, Pradeep
Stateful Session Beans do not live between server restarts. If you need a long-lived object then you will need to use either Entity Beans or just plain DAO (possibly with a Session Bean).
Aakash, But does it make any sense even if the session bean is recreated, the customer in most likelyhood of the cases would have destroyed the session after the failure of the application Server. Am I missing some point? Thanks, Pradeep
Originally posted by aakash bhatt: Hi Chris I think in Websphere u can write the state of Session into a file and if Application server restarts the Session bean automatically checks the state and continues from there. Regards, aakash
Are you talking about passivating your session bean into streams in a file system? Find the details on any EJB book. This should be available for J2EE and not just WeBSphere.