File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Persistence Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Persistence Framework" Watch "Persistence Framework" New topic

Persistence Framework

evan chris

Joined: May 24, 2005
Posts: 7
Hey Folks,

Am looking for some kind for information in choosing the backend framework. I have many framework in front of me but got confused.

- Spring framework
- Hibernate
- IBaptis

Pls throw some light on this.

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
What are your requirements???

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Scott Ambler
Ranch Hand

Joined: Dec 12, 2003
Posts: 608
I cover the basic concepts of persistence frameworks at Encapsulating Database Access and The Design of a Persistence Layer. Between the two essays you should learn the basics of the concept and then be able to determine what you actually need from the framework.

For detailed mapping requirements, Mapping Objects to RDBs will provide some ideas for what you should look for.

- Scott

<a href="" target="_blank" rel="nofollow">Scott W. Ambler</a><br />Practice Leader Agile Development, IBM Rational<br /> <br />Now available: <a href="" target="_blank" rel="nofollow">Refactoring Databases: Evolutionary Database Design</a>
evan chris

Joined: May 24, 2005
Posts: 7
scott / ilja,

thanks for your response. my requirement is not complex. I can go for simple JDBC / EJB calls. I thought of implementing the open source framework in my current project which gives good performance, in turn helps me to learn another technology.

Pls let me know your suggestions to chose the best persistence framework opensource.

I appreciate your effort.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Moving this to the Object Relational Mapping forum.

Well, I changed my mind since not all the frameworks you mentioned are all about persistence. Spring and EJB I wouldn't classify as persistence frameworks. Yes, EJB has Container and Bean Managed Entity beans, but that is a specification, not an actual framework, per say. The Spring is more of like an Application Container Framework, that is more involved than persistence. And with Spring and EJB, most people will still use a seperate persistence framework.

OK, so I will move it anyway.

[ July 13, 2005: Message edited by: Mark Spritzler ]

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Pj Murray
Ranch Hand

Joined: Sep 24, 2004
Posts: 194
Hi there,

Learning a new technology is not a great criteria for choosing a Java persistence strategy for an application (unless that's the purpose of the project). It's good that the initial responses have been about your technical requirements - that's certainly where you should start.

Your list of options includes a diverse range of items related to Java persistence. Can I suggest that you read "Choosing a Java Persistence Strategy" to get started:

From your list:

-DAOs are a design strategy - see below.

-By EJB I presume you mean EJB CMP - you still need an EJB container.

-Spring is more of a container than specifically a persistence framework.

-JDBC is still the most used Java persistence technology - and its a good solution if you're also using DAOs.

-Hibernate - the most popular free open source Java persistence framework.

You can read a more detailed comparison of most of the technologies you mention here:

Data Access Objects

DAOs are a design decision and best practice. Read Scotts "Encapsulating Database Access" to see where DAO fits in.

You should consider using DAOs even if you decide to use an ORM persistence framework. I recently wrote a blog entry on the topic of DAOs and Hibernate:

Also, you can find a discussion on "Data Access Object (DAO) versus Object Relational Mapping (ORM)" here:

As you can see, what CodeFutures is suggesting to Hibernate users is that they at least try both straight Hibernate and Hibernate with DAO.

There are some non-technical factors that you should consider when choosing a Java persistence technology. Here's a management perspective on the topic:

So, you've got lots of homework!

Between reading Scott Ambler's excellent material and CodeFutures' less formal blogs you should be able to figure out a strategy that is appropriate for your requirements.

PJ Murray -
Mike Keith
Ranch Hand

Joined: Jul 14, 2005
Posts: 304

Since this seems to just be a place to shill your product let me add my shilling to the mix.

Oracle TopLink is the most widely used commercial O/R mapping product on the market so if you have any serious requirements I recommend you download it and benchmark it against any other product that you are considering.

There are some white papers available there as well that you might want to put on your homework stack.

If you are just playing around then any old O/R mapper will do. Whatever you do, if you predict that your app will EVER grow to use more than just a handful of classes then please don't use JDBC. Use an O/R mapper, any one. I have seen too many companies get lured into rolling their own persistence for just a few objects, and it grows, and grows, until they end up with their own franken-mapping layer and wish they had done a little more planning up front.

TopLink Architect

Pro JPA 2: Mastering the Java Persistence API
Appu Chan

Joined: Aug 29, 2002
Posts: 28

I would suggest Hibernate for Persistence and Spring for the Application framework.

I agree. Here's the link:
subject: Persistence Framework
jQuery in Action, 3rd edition