I wrote a stateful session bean and a local entity bean.
The session bean serves as a facade to retrieve data via the entity bean. The DB is PostgreSQL 7.1.3 running on Linux. I put 15,000 records on a table called company. I only put data in the primary key field which is VARCHAR(32). The data is UUID-like pk.
I then test a client to get all primary keys from company by invoke the method getALL(). In the session bean, I use an ArrayList the catch all the primary keys and return back to the client.
Before I changed the max-capacity from default (1000) to 1500 for Standard CMP 2.x EntityBean, the Exception occurred when getting to record 1001. After changes,
I got TransactionRollbackException when getting to a dynamic number of records, say 4051, 8179, etc.
However, after setting max-capacity as 15000, it can run to record 11052.
What is the best practice to config the max-capacity? Why the numbers of records differ in different tests?
I understand that I should not dump all data to clients even I use a session bean with local entity beans. However, when I want to provide a browsing list for the client like Access does, what is the best practice to do it? The getAll() will, well, gets all records. Accroding to Core J2EE Patterns and Best Practices, I should load a portion of records at the first time and load the rest by request. Is there something like getRange(int from, int to)? How to implement it? Please direct me to some sources. Thanks.