[uportal-dev] Paradigm advice on working with hibernate in Simple Content Portlet
A while back I made an attachments manager for the Simple Content Portlet to allow our marketing staff to upload arbitrary files to the portal and receive a link to them. It had some minor flaws, like not knowing how many attachments there were in total and so not knowing how to paginate properly, but it worked well enough. Recently though we've run into another flaw of the portlet as I've designed it: It loads all the attachments at once. This wasn't an issue when the number of attachments was small, but now we have passed 2500 attachments and that means loading this portlet requires loading 3+gb of data from the database and then promptly dumping it.
This is where I need some advice, I've always said Java isn't my first language and Hibernate is particularly so not my style of programming. If I was doing this manually by requesting the row from SQL I would just leave off the bdata column and only load the metadata. But just leaving off one column does not seem to be a straight forward concept in Hibernate. Before I hack something together I figured I'd ask people a little more in tune with this style of programming, what is the recommended way of achieving this?