Java Reference
In-Depth Information
with Stripes. Now, since JPA is only a specification, you also need an
implementation; I chose Hibernate because it's widely used. I don't use
anything Hibernate-specific in the sample code, so things should work
the same if you decided to replace Hibernate with any other JPA imple-
Aaron Porter, Stripes committer, smart developer, and all-around nice
guy, wrote a library that facilitates the integration of JPA in Stripes,
named Stripersist.
2
Crack your knuckles, we're going to set up a data-
base and use JPA, Hibernate, and Stripersist to implement the persis-
tence of the webmail application model data.
Setting Up a Database
Of course, we'll need a database to get started. Any database that has
chances are that they provide a JDBC driver as well.
setting it up is extremely simple. I also like that it comes with a GUI
so that you can browse the database and poke around. If you have
Ant installed, you can just go to the directory where you unpacked the
source code bundle and start the database server using this:
ant dbstart
ant dbgui
Finally, to shut down the server, use the following:
ant dbstop
When running the examples that use the database, make sure to start
the database server before launching the web application.
Setting Up JPA, Hibernate, and Stripersist
Now that the database is ready, the next step is to set up JPA, Hiber-
nate, and Stripersist. You'll find all the required JAR files in the
lib/
hibernate
and
lib/stripersist
directories of the sample code bundle.
2.
Search WWH ::
Custom Search