Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Looking for a lightweight persistance framwork

Reply
Thread Tools

Looking for a lightweight persistance framwork

 
 
Lew
Guest
Posts: n/a
 
      05-16-2009
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
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      05-16-2009
Mark Space wrote:
> Here's a list, at least. I can't recommend one above another. If you
> do choose one from this list, post your impressions to this group, I
> think some folks would be interested.
>
> <http://java-source.net/open-source/persistence>


I've used Torque. It sucked.

I've used Castor, a little. It's a bit clunky, but serviceable. I don't like
it as much as other alternatives.

I've studied JDO and used it slightly. Go with JPA.

I've used OpenJPA and Hibernate quite a bit. Both are strong products that
aren't too difficult to use at all. (I am still not good at getting
automagical injection of entities and entity managers, though. It hasn't been
much of a handicap; I just instantiate explicitly based on the
persistence.xml.) The list omits EclipseLink (erst TopLink) for some reason;
it's another JPA layer that is very reliable.

Use a JPA framework. It's easier than raw JDBC calls, more effective and far
easier than other ORM frameworks I've used, performs well and is quite reliable.

--
Lew
 
Reply With Quote
 
 
 
 
Roger
Guest
Posts: n/a
 
      05-16-2009
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
persistance framework like iBatis or Hibernate, and I really can't be arsed
to roll my own. So what would people recommend?

Regards

 
Reply With Quote
 
Giovanni Azua
Guest
Posts: n/a
 
      05-16-2009
Hi there,

"Lew" <(E-Mail Removed)> wrote in message
> 3) Use a JPA framework like Hibernate, OpenJPA or EclipseLink with a DBMS
> like Derby (comes with Java already) or Postgres.
>

If I may add anything I would split point 3 into:

3.1) Stay at pure JPA i.e. define your ORM and configuration using the JPA
specs either annotations or xml (I prefer xml)
3.2) Use the native implementations to define your ORM e.g. Hibernate,
TopLink

If I may recommend I would go for 3.1 and stay away from 3.2 which might be
tempting with tools like TopLink Workbench. Now, while using the JPA API
switching to framework-specific interfaces is some times desiderable for
exploting richer functionality e.g. Criteria API. btw seens that JPA 2 will
support Criteria API so they are catching up
http://jcp.org/en/jsr/detail?id=317

> 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.
>

Very nice, I agree totally

Best regards,
Giovanni



 
Reply With Quote
 
Giovanni Azua
Guest
Posts: n/a
 
      05-16-2009
"Steve Sobol" <(E-Mail Removed)> wrote in message
> On 2009-05-16, Roger <(E-Mail Removed)> 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
>> persistance framework like iBatis or Hibernate, and I really can't be
>> arsed
>> to roll my own. So what would people recommend?

>
> http://activeobjects.dev.java.net/
>

A bit misleading for a name ... Active Objects is a well known concurrency
pattern:
http://en.wikipedia.org/wiki/Active_Object

Best regards,
Giovanni


 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      05-17-2009
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
> persistance framework like iBatis or Hibernate, and I really can't be arsed
> to roll my own. So what would people recommend?


What do you really mean by that the project doesn't warrant something
like Hibernate?

You don't pay for it. If you would use it for a more complex project
then you must already know it. Code wise it is minimal effort.

Arne
 
Reply With Quote
 
Karl Uppiano
Guest
Posts: n/a
 
      05-17-2009

"Lew" <(E-Mail Removed)> wrote in message
news:gumt09$nhh$(E-Mail Removed)...
[...]
> 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.


In addition to which, they are generally more extensible, which is nice when
you discover after a few revisions, that your application really does need a
full blown solution.

 
Reply With Quote
 
Giovanni Azua
Guest
Posts: n/a
 
      05-17-2009
Hi Steve,

"Steve Sobol" <(E-Mail Removed)> wrote in message
>>> http://activeobjects.dev.java.net/
>>>

>> A bit misleading for a name

>
> But perfect as a simple persistence framework.
>

I don't mean to be skeptical but to me this looks like another reincarnation
of JPA misleading it with a name of a concurrency Pattern to confuse the
masses. It is almost identical to JPA (like a copy-paste) but with the added
"These releases are for testing purposes only and should be considered to be
unstable":
https://activeobjects.dev.java.net/example.html

I would recommend going JPA, you go JPA you never go back

> I use AO. It rocks.
>

How does it rock better compared to using JPA?

The "Why ActiveObjects?" looks to me like another rewording of the
"Hibernate is too full blown" vs my nicer lightweight argument, btw it
compares against Hibernate only, there is no a single word on JPA or any
other persistence provider:
https://activeobjects.dev.java.net/why.html

To my ears this type of slogans sound more like a threat than anything
appealing:

- My product A is better because it is more "Lite" "Lightweight"
- My product A can do in 1 line what product B does in 200 lines
- My product A is better because it is a jar only 5k big

I don't mean to proof anyone wrong or anything but looking at this solution
I wonder how can this be better for you than JPA.

Best regards,
Giovanni


 
Reply With Quote
 
Arved Sandstrom
Guest
Posts: n/a
 
      05-17-2009
Giovanni Azua wrote:
> Hi Steve,
>
> "Steve Sobol" <(E-Mail Removed)> wrote in message
>>>> http://activeobjects.dev.java.net/
>>>>
>>> A bit misleading for a name

>> But perfect as a simple persistence framework.
>>

> I don't mean to be skeptical but to me this looks like another reincarnation
> of JPA misleading it with a name of a concurrency Pattern to confuse the
> masses. It is almost identical to JPA (like a copy-paste) but with the added
> "These releases are for testing purposes only and should be considered to be
> unstable":
> https://activeobjects.dev.java.net/example.html
>
> I would recommend going JPA, you go JPA you never go back

[ SNIP ]

Apart from the fact that it looks similar to JPA (granted, I just looked
at the example), I'm leery of anything like this that overly sells the
ability to quickly and painlessly change your data model. I'm not a
refactoring nut, but I do see some uses for it - one of them is _not_
constantly changing your database classes. Doing that, IMHO, is a sign
of bigger problems, and it's no selling point if your persistence
framework makes a bad habit easier.

AHS
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      05-17-2009
Steve Sobol wrote:
> Ease of setup is really my main concern, followed by volume of code needed to
> do what you need to do. With AO, reading from your database, or persisting
> your object to said database, only requires a couple lines of code.
>
> Believe me, I'm not saying AO is for everyone. But I really like it.


The same considerations apply to JPA, in the simple case. You set up a 12-15
line XML file to define the database connection parameters, add 3-5 lines of
annotation to each entity POJO and 2 to instantiate an entity manager, and
Bob's your uncle. You don't even have to inherit an entity type.

Easy and compact and standard. And the Javadocs don't have spelling errors
(that I could find at first glance, unlike with AO).

--
Lew
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for fairly used Sysmaster Voicemail Framwork(3000) veezcom VOIP 0 07-16-2005 04:20 PM
Persistance,Persistance,Persistance MHPNW STAFF Windows 64bit 5 05-24-2005 09:29 PM
Looking for a DB for object persistance... Francois Meehan Python 1 02-06-2004 01:27 AM
New framwork (persistence integrated with form generation) Sergio Baca Java 0 11-17-2003 07:34 PM
Framwork Version issues Chad Crowder ASP .Net 2 08-13-2003 04:03 AM



Advertisments