3. JPA Configuration

These are the two DB specific properties files that are loaded by their respective Spring profiles in dao-datasource-context.xml.

sql/hsql.properties
                
jdbc.driver.class=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:mem:contact
jdbc.username=sa
jdbc.password=

jpa.persistence.unit.name=hsql
jpa.show.sql=false

jpa.cache.use_second_level_cache=false
                
            

It is expected that the database is already initialzed before running the application. In the contact-app project there is a scripts directory that contains init-postgres.sh and reinit-postgres.sh. The first script will just create the DB, user, and schema. The second will drop the DB and user first, before creating everything.

sql/postgresql.properties
                
jdbc.driver.class=org.postgresql.Driver
jdbc.url=jdbc:postgresql://localhost:5432/contact
jdbc.username=contact
jdbc.password=contact

jpa.persistence.unit.name=postgresql
jpa.show.sql=false  1

jpa.cache.use_second_level_cache=true
                
            
1 This can be set to true by passing it in as a Java system property or by setting it in a contact-app.properties file.