Enterprise Java Development@TOPIC@
src |-- main | |-- java | | `-- ejava | | `-- examples | | `-- daoex | | |-- bo | | | `-- Author.java | | |-- dao | | | |-- AuthorDAO.java | | | `-- DAOException.java | | `-- jpa | | `-- JPAAuthorDAO.java | `-- resources | `-- META-INF | |-- orm.xml | `-- persistence.xml (could be placed in src/test branch) `-- test |-- java | `-- ejava | `-- examples | `-- daoex | `-- jpa | |-- JPAAuthorDAOTest.java | |-- JPACRUDTest.java | |-- JPAExtendedOnlyTest.java | |-- JPAMembershipTest.java | |-- JPASyncTest.java | `-- JPATestBase.java `-- resources |-- hibernate.properties (optional) `-- log4j.xml
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.1.Final</version>
<scope>test</scope>
</dependency>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
...
</build>
Above will depend on whether you use src/main or src/test for resource file(s)
<properties>
<!-- standard properties -->
<property name="javax.persistence.jdbc.url" value="${jdbc.url}"/>
<property name="javax.persistence.jdbc.driver" value="${jdbc.driver}"/>
<property name="javax.persistence.jdbc.user" value="${jdbc.user}"/>
<property name="javax.persistence.jdbc.password" value="${jdbc.password}"/>
<!-- hibernate-specific properties -->
<property name="hibernate.dialect" value="${hibernate.dialect}"/>
...
</properties>
<properties>
<jdbc.driver>org.h2.Driver</jdbc.driver>
<jdbc.url>jdbc:h2:${basedir}/target/h2db/ejava</jdbc.url>
<jdbc.user>sa</jdbc.user>
<jdbc.password/>
<hibernate.dialect>
org.hibernate.dialect.H2Dialect
</hibernate.dialect>
</properties>
<properties>
<!-- standard properties -->
<property name="javax.persistence.jdbc.url" value="jdbc:h2:/home/jcstaff/proj/ejava-javaee/git/jpaDAO/target/h2db/ejava"/>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
<!-- hibernate-specific properties -->
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
...
</properties>