I created a really simple application for requesting items, tools and what not. I used a database to keep all this information stored. My requisition manager class uses a getter which return a new instance of the requisition using information from the database. Will this new object in on the stack forever? How can I force it to get collected? How can I make this better, as in how can I write the function without creating a new object?
public static Requisition getRequisition(int id) {
//logic for getting the correct id and so forth
return new Requisition(id, /*logic for name*/, /*logic for price and other fields*/);
}