The majority of applications need to persist (or store) data during their lifecycle. There are many ways of doing this with an application written in Java. You can handle the persistence (and retrieval) of data yourself using JDBC. With JDBC, you have the burden of having to write the persistence layer yourself. This gives much control, but also creates significant work, both in writing the code but also in testing and maintenance. You could also use J2EE, and persist data using Entity Beans. With J2EE you hand off the persistence of your objects to the EJB part of the J2EE server. This simplifies things, but places a major restriction on your code in that you have to write your objects as Entity Beans. In addition J2EE adds layers that are not necessarily required for your application. You can use a proprietary or non-standards compliant persistence framework like TopLink, or Hibernate and persist your plain old Java objects. You will, however, be tied in to their API and be unable to easily move your system to an alternative implementation. Alternatively you can use JDO, a standardised persistence interface. With JDO you can take your plain old Java objects and just persist them as they are. It is totally transparent and very little work is required by the developer. To give a guide, here are a few important consideration points when choosing a persistence layer for your application.
|