Java Reference
In-Depth Information
<!-- Tell Hibernate to use HSQLDB -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
<!-- Configure the JDBC database connection -->
<property name="hibernate.connection.url"
value="jdbc:hsqldb:hsql://localhost:9001/webmail"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="jdbc.batch_size" value="0"/>
<!-- Configure the connection pool -->
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="300"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="3000"/>
</properties>
</persistence-unit>
</persistence>
Setting up Stripersist is a one-liner in the web.xml file. Add the Striper-
sist package to the list of Stripes extension packages:
Download email_23/web/WEB-INF/web.xml
<init-param>
<param-name> Extension.Packages </param-name>
<param-value>
stripesbook.ext,
org.stripesstuff.stripersist
</param-value>
</init-param>
You're ready to go!
Using JPA Annotations in the Model
Now that the database, JPA, Hibernate, and Stripersist are rearing to
work for us, the next step is to tell JPA about our model classes, which
we've been gradually adding to the application throughout most of the
book. JPA provides several annotations that we add to classes and
properties so that JPA can figure out how to do the mapping between
the model and database tables.
Let's have a global view of our webmail application's model. As illus-
trated in Figure 12.2 , on the next page, there are users, aliases,
contacts, folders, messages, and attachments. We have to let JPA know
 
 
Search WWH ::




Custom Search