Adding JPA provider as user manager

This commit is contained in:
Martin Stockhammer 2016-10-09 21:20:45 +02:00
parent 0cc2733ca0
commit b7174c4440
5 changed files with 67 additions and 3 deletions

View File

@ -831,6 +831,18 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
@ -969,6 +981,8 @@
<additionalClasspathDirs>
<additionalClasspathDir>${basedir}/src/test/tomcat</additionalClasspathDir>
</additionalClasspathDirs>
</configuration>
<dependencies>
<dependency>
@ -981,6 +995,27 @@
<artifactId>mail</artifactId>
<version>${javaxMailVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpaVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.serp</groupId>
<artifactId>serp</artifactId>
<version>1.15.1</version>
</dependency>
</dependencies>
</plugin>

View File

@ -21,13 +21,14 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:util="http://www.springframework.org/schema/util" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd"
http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
default-lazy-init="true">
<context:annotation-config/>
@ -48,5 +49,15 @@
<jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/redbackjpa" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" >
<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
</property>
</bean>
</beans>

View File

@ -143,6 +143,12 @@
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/redbackjpa</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>mail/Session</res-ref-name>
<res-type>javax.mail.Session</res-type>

View File

@ -24,8 +24,18 @@
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${appserver.base}/database/users;create=true"
/>
<Resource name="jdbc/redbackjpa" auth="Container" type="javax.sql.DataSource"
username="sa"
password=""
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:${appserver.base}/database/jpausers;create=true"
/>
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"
mail.smtp.host="localhost"/>
</Context>

View File

@ -91,6 +91,7 @@
<javaxMailVersion>1.4</javaxMailVersion>
<jettyVersion>8.1.14.v20131031</jettyVersion>
<guava.version>16.0.1</guava.version>
<openjpaVersion>2.4.1</openjpaVersion>
<!-- restore when we will be able to use a derby in memory database -->
<redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl>
@ -1537,6 +1538,7 @@
<artifactId>jsoup</artifactId>
<version>1.7.2</version>
</dependency>
</dependencies>
</dependencyManagement>