Re: Looking for a lightweight persistance framwork
Roger wrote:
I'm about to start a small web project that's going to need a small database
comprising about half a dozen master data tables and two or three
transactional tables. The size of the project doesn't warrant a full blown [sic]
persistance [sic] framework like iBatis or Hibernate, and I really can't be arsed
to roll my own. So what would people recommend?
You basically only have three choices:
1) Use some sort of custom serialization and re-invent the DBMS to handle your
tables and their relationships.
2) Use a DBMS like Derby (comes with Java already) or Postgres and write JDBC
calls.
3) Use a JPA framework like Hibernate, OpenJPA or EclipseLink with a DBMS like
Derby (comes with Java already) or Postgres.
I'd avoid 1) - there's no point in re-inventing the wheel when there are
thoroughly debugged, stable and robust alternatives.
I've done both 2) and 3), a lot. I've found that 2) seems easier at first,
but quickly runs into issues that 3) solves, forcing you to re-invent the
persistence wheel anyway.
Option 3) is a lot less "full blown" than you think. It involves a couple of
days learning and the addition of a couple of JARs to your project. It might
not be any more effort than 2).
People use the term "full blown" as a pre-judgment of possible solutions as if
it were synonymous with "harder and slower". Surprisingly, "full blown" often
comes with "easier and faster", as well as "more free of bugs", at least in
elementary uses of the so-called "full-blown" solutions.
--
Lew