I would like to know , how would we GC the domain objects / value objects that are retrived from the database to be displayed in JSP. How/when we can make sure that those objects , after they are done with the display will be GC'd.
The domain objects are large in number that are retreived from the database. Say for example , 1000 Person objects or 1000 rows of Person data. or 1000 Persons.
Make sure there are no more references to them. Usually, when you don't need them anymore, local references to them go out of scope an they are collected without any more work on your part. However, you have to be careful if you save references to them in some sort of list field, or have static references to them. In these cases, you will have to make sure you delete them from the list, or null out the reference.
Thanks for the explanation.i would like to how could i decide if the objects are no longer needed or they need to be retrieved from the database again.I mean when could i decide that i dont need them anymore and how , once they are presented to the user in listing table of HTML. Or when i could take the decision to save the references.
Take for example , once i've the List of <Person> from the database, i set it to request attribute for display in the listing JSP. So, once the request forwards the list to the JSP and the JSP draws all the listing elements. So once i set it to request attribute, is that the next line i would do something like this ...