I’m a begginer concerning the Notes/Xpages technologies and I’m facing a conception issue :
I have an XPages Application running on Domino Server.
We are trying to modernize our development practices using Java and JSF possibilities, I would like to introduce the MVC pattern in our applications.
I will try to sum it up clearly:
Let's consider a global locking system on domino documents. I have an xsp which represents the details of the document : document_details.xsp. This form uses a controller class DocumentDetailsAction.java. This class is also a managed bean with view scope.
So when the user clicks on an 'edit' button on my xsp : boolean DocumentDetailsAction.isDocumentLocked(String unid) is invoked.
if false, the document changes to edit mode, etc. if true, add a Message to inform the user that the doc is locked.
With the MVC pattern, the method isDocumentLocked instantiates a business service class : DocumentLockBO which contains the business logic concerning to the locking system. This business class has a DocumentLockDAO instance as an attribute. This attribute is instantiated in the constructor.
In my DAO, I instantiate a Domino Database object in the constructor and set it as an attribute of my class.
Problem : Let's imagine that the document is locked and that the user clicks on the edit button a million times! Each time, DocumentLockBO, DocumentLockDAO and finally Domino-Database objects will be instantiated.
That's a real nightmare for memory and performances. A solution : using an instance of DocumentLockBO and set it as an attribute of my controller class. On each click, the same instance of BO/DAO/Domino-Database objects will be used Problem : DocumentLockBO has a DocumentLockDAO attribute which has itself a Domino-Database attribute.
A serialization Exception occurs with Domino object!
Am I taking the right direction? Any suggestions?