Java Persistence API (JPA) allows persisting objects in Java SE and EE environments. But JPA is only the API - the SPI (service provider) ist still needed. JPA is already supported by openJPA, Hibernate and TopLink essentials (a part of the Java EE RI).
Hibernate comes with 38 Jars (the core) and 5 additional jars for the Entity-Manager. So you need about 45 Jars in the classpath which has to be downloaded from 2 locations. openJPA comes with 11 jars - but it needs a setup of the javaagent (-javaagent:.[path]openjpa-all-0.9.6-incubating.jar). All jars can be downloaded from one location.
TopLink essentials comes with 2 Jars - and can be downloaded from one location - not javaagent settings are needed. The good news are: you can switch the persistence provider every time - only the classpath and one entry in the persistence.xml has to be set.
Sample (unmanaged enviroment):
<!-- Provider-specific connection properties -->
<property name="toplink.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="toplink.jdbc.url" value="jdbc:derby:./javaee5patterns;create=true"/>
<property name="toplink.jdbc.user" value="javaee5"/>
<property name="toplink.jdbc.password" value="patterns"/>
<!-- Provider-specific settings -->
<property name="toplink.logging.level" value="FINE"/>
<property name="toplink.ddl-generation" value="drop-and-create-tables"/>
I use TopLink together with JavaDB for the examples of my book "Java EE 5 Architectures" - also because of simplicity. BTW: Netbeans 5.5 and 6.0 supports the development of Java EE 5 apps with integration of JavaDB, glassfish, generation of persistence.xml and built-in SQL-explorer very well. Only the JPA support of standalone, unmanaged, JPA-applications could be better (you have to choose one appserver first...). You can also use Eclipse 3.X with Dali (eclipse.org/dali) with similar functionality. You can even use both and map the projects to the same directory...
airhacks.fm the podcast:
Stay in touch: airhacks.news.