I have a problem with two days and I canโt get out of this.
The problem I am facing is using the MangedBean property after deserialization (I think).
The property (purchaseManager) is configured using Spring and uses the DAO, which extends MyBatis as a data map for interacting with the database.
In fact, the first time you access the page, the purchaseManager.getAll () method inside init () works fine.
When I try to call refreshList () as an action using a button, I have a NullPointerException on getSqlSession () inside the DAO.
Providing only the appropriate code, follow these steps:
@ManagedBean(name = "purchaseController") @ViewScoped public class PurchaseController implements Serializable{ @ManagedProperty(value = "#{purchaseManager}") private PurchaseManager purchaseManager; @PostConstruct public void init(){ purchaseManager.getAll(); } public void refreshList(){ purchaseManager.getAll(); } } public class PurchaseManagerImpl implements PurchaseManager, Serializable { PurchaseDAO purchaseDAO; public void getAll() { purchaseDAO.getAll() } } public class PurchaseDAOImpl extends SqlSessionDaoSupport implements PurchaseDAO, Serializable { public void getAll() { SqlSession session = getSqlSession();
If I change STATE_SAVING_METHOD to the server, the application works fine, but that is not what I want. The same thing if I make ManageBean as RequestScope, but it will also punish my requirements.
Thank you in advance for any help! Ermal
spring jsf managed-bean viewstate mybatis
Ermal Apr 3 2018-12-12T00: 00Z
source share