I have an application using sleep mode. On the one hand, I'm trying to get documents. Each document has an account number. The model looks something like this:
private Long _id;
private String _acct;
private String _message;
private String _document;
private String _doctype;
private Date _review_date;
Then I get the documents using the document service. Part of the code is here:
public List<Doc_table> getDocuments(int hours_, int dummyFlag_,List<String> accts) {
List<Doc_table> documents = new ArrayList<Doc_table>();
Session session = null;
Criteria criteria = null;
try {
session = HibernateUtil.getSession();
session.beginTransaction();
if (accts == null) {
Calendar cutoffTime = Calendar.getInstance();
cutoffTime.add(Calendar.HOUR_OF_DAY, hours_);
criteria = session.createCriteria(Doc_table.class).add(
Restrictions.gt("dbcreate_date", cutoffTime.getTime()))
.add(Restrictions.eq("dummyflag", dummyFlag_));
} else
{ criteria = session.createCriteria(Doc_table.class).add(Restrictions.in("acct", accts));
}
documents = criteria.list();
for (int x = 0; x < documents.size(); x++) {
Doc_table document = documents.get(x);
......... more stuff here
}
This works great if I get a small amount of documents. But when the size of the document is large, I get an error in the heap area, probably because the documents take up a lot of space, and when you extract a few thousand from them, bad things happen.
All I really want to do is get every document that matches my criteria, grab the account number and return a list of account numbers (a much smaller object than a list of objects). If it were jdbc, I would know exactly what to do.
. , , Doc_table.
, , - , , ( , , ).