Re: Paradigm advice on working with hibernate in Simple Content Portlet

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Paradigm advice on working with hibernate in Simple Content Portlet

Andrew Petro-3
Can't say I'm in tune with Hibernate programming, or ever was. I once made a mess of using Hibernate to store and load the login timestamp.

That said, were I in your shoes I'd be looking at Hibernate's lazy-loading features and seeing if I could get it to understand that the attachment part of the data should only be materialized when actually touched. I *think* Hibernate has magic annotations for this kind of case.

As ever,

Andrew

On Wednesday, October 30, 2019 at 8:49:40 AM UTC-5, Toby Archer wrote:
A while back I made an attachments manager for the <a href="https://github.com/Jasig/SimpleContentPortlet" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJasig%2FSimpleContentPortlet\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH-LWZekaRm5lTsLiKfTYCmCvzpAA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJasig%2FSimpleContentPortlet\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH-LWZekaRm5lTsLiKfTYCmCvzpAA&#39;;return true;">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? 

~TA

--
You received this message because you are subscribed to the Google Groups "uPortal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/uportal-dev/e95a04ca-120d-46f9-949d-be73c90a46c1%40apereo.org.