Re: How to best use Hibernate
- From: Chris Smith <cdsmith@xxxxxxx>
- Date: Tue, 9 May 2006 22:43:47 -0600
Snyke <Decker.Christian@xxxxxxxxx> wrote:
Ok I have a business application which has persists its data to a
database using hibernate. What I want to know is what is the best
practice for persistence?
- Load it all into memory and then synchronize to the database.
- Load only parts out of the persister, modify it and then save it
back to the database.
- Hybrid of those, loading into memory changing it there,
synchronizing it to the database but leave the data in memory so I
don't have to reload it again.
Obviously the last option has a lot of overhead, because of its dynamic
loading, the first is my preferred one, but am I using all the
potential of Hibernate, and is the effort managable for lots and lots
of data? The second is what looks like a standard solution, but doesn't
the Hibernate stuff add a lot of overhead to this one too?
First of all, Hibernate doesn't add "a lot" of overhead to very much.
The product writes nearly optimal SQL in most cases (some minor
exceptions, such as outer joins with PostgreSQL pre-8.2 as was pointed
out to me recently). Certainly the computational work of Hibernate
itself is trivial next to talking to a database.
Next, how much you modify prior to updating the database should be
determined first and foremost by the transactional boundaries of the
application. Hibernate has plenty of nice caching options, so you don't
need to let database performance issues dominate your system
architecture by trying to load and keep all this data in memory
intentionally. The cache does that. You can just write code to do what
you want.
That's the best I can do from your question. You'll get better answers
if you're more specific.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
.
- References:
- How to best use Hibernate
- From: Snyke
- How to best use Hibernate
- Prev by Date: Re: how to ignore separator??
- Next by Date: Appfuse, equinox what are they exactly?
- Previous by thread: Re: How to best use Hibernate
- Next by thread: Can you get the amount of UDP buffer space used?
- Index(es):
Relevant Pages
|
Loading