When should clear () be used?

1

I made an application using the JSF-JPA archetype pattern for list and edit screens, extending from AbstractListPageBean and AbstractEditPageBean respectively, using Bookmark pages as a reference.

I saw the "New" and "Delete" buttons have actionListener pointing to the clear() method. In the editing screens the AbstractEditPageBean has the same method but is not called.

Should%% be always called when exiting the screen to avoid accumulation of objects in memory?

    
asked by anonymous 07.08.2015 / 19:02

1 answer

0

It is not exactly to avoid the accumulation of memory, but it also helps. Actually in the New and Delete methods you need to clear the information of a Bean that may be being listed or edited. In the case of "Delete" it is clearer because the record has been read and when it is deleted the information of it should be cleaned. In the case of the New button, it may be that another record has been read, and to make sure it has nothing and done the clean.

    
07.08.2015 / 21:41