Hello All,
You will probably tell me to CTFI on this one, but I have been searching for a little over an hour and can find no best practices, standard solutions, or examples regarding my problem.
I am using Hibernate with a legacy database system and I have no control over the database structure. I have Hibernate configured properly and running correctly. However, I am running into a quite a large performance issue.
The database table I am trying to access contains 30 some char or varchar fields and a BLOB. The BLOB field is usually 4MB in size. Not the smartest database design in the world, I know, but that's a different issue for a different forum. The POJO that I created for Hibernate looks something like this:
Code:
public class MyObject {
string field1;
string field2;
// etc etc
byte[] data;
// cunstructors, getters and setters
}
At any point in time, there can be hundreds of thousands of records in this particular database table. I am creating a web interface to allow a user to "preview" the rows in the table. The user will provide some initial search criteria to somewhat limit the number of records returned. Any way you look at it, there will be MANY records returned, however. Since there is no reason to display the binary data in the byte array in the web interface, and because fetching 4MB x 6000 records would be an obvious performance no-no, I would like to defer the fetching of the data in the BLOB field in the database until a later time (ie. the user clicks the record).
If I controlled all aspects of this application, I would most likely create two database tables/POJO mapping classes, called something like MyObjectData and MyObject and simply maintain a one-to-one relationship between the two. As I have mentioned, I have no control over the strcuture of the database, so this is an impossibility.
Aside from this solution, what else can I try?
Thanks so much for your help!