Re: How to best use Hibernate
- From: "Arvind" <asrinivasan@xxxxxxxxxxxxx>
- Date: 9 May 2006 16:03:12 -0700
Snyke 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.
Depends on what "all" represents i.e. the underlying datastructure. For
e.g. if you are updating a tree structure of objects, does all
represent the entire tree, or a leg of the tree that matches the update
condition ?
- Load only parts out of the persister, modify it and then save it
back to the database.
Same question as above.
- 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.
When manually done, the potential for buggy code is quite high in this
style.
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?
Hibernate does take care of the hybrid quite nicely, goes well with
many web frameworks, provides caching, takes care of create/update
scenario etc. Works quite well for us.
There are also other options like Castor etc that provide Object to DB
mapping via configuration and away you go writing business logic,
leaving the worrisome db coding, connection management etc to these
frameworks.
--
Arvind
.
- References:
- How to best use Hibernate
- From: Snyke
- How to best use Hibernate
- Prev by Date: Can you get the amount of UDP buffer space used?
- Next by Date: Re: System.getenv()
- Previous by thread: How to best use Hibernate
- Next by thread: Re: How to best use Hibernate
- Index(es):
Relevant Pages
|
Loading