Fix #167 - Rename "myEntityManagerFactory" to just

"entityManagerFactory" as this is the default expected in some spots in
Spring
This commit is contained in:
James Agnew 2015-04-30 09:36:14 -04:00
parent cb7d94841e
commit 5cf5bb0473
15 changed files with 102 additions and 33 deletions

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.util;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2015 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import javax.servlet.http.HttpServletRequest;
import ca.uhn.fhir.context.FhirContext;

View File

@ -27,7 +27,7 @@
-->
</bean>
<bean id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="persistenceUnitName" value="FHIR_UT" />
<property name="jpaVendorAdapter">
@ -41,7 +41,7 @@
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -30,7 +30,7 @@
-->
</bean>
<bean id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="persistenceUnitName" value="FHIR_UT" />
<property name="jpaVendorAdapter">
@ -43,7 +43,7 @@
</property>
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -17,7 +17,7 @@
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -32,7 +32,7 @@
database (e.g. Postgres). Consult the Hibernate documentation to see a list of
available dialects.
-->
<bean id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
<property name="persistenceUnitName" value="FHIR_UT" />

View File

@ -17,7 +17,7 @@
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -56,7 +56,7 @@
</bean>
-->
<bean depends-on="dbServer" id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean depends-on="dbServer" id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
<property name="persistenceUnitName" value="FHIR_UT" />

View File

@ -34,7 +34,7 @@
<!-- <property name="url" value="jdbc:derby:directory:myUnitTestDB;create=true" /> -->
</bean>
<bean id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<property name="persistenceXmlLocation" value="classpath:fhir_jpatest_persistence.xml" />
<property name="persistenceUnitName" value="FHIR_UT" />
@ -47,7 +47,7 @@
</property>
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -17,7 +17,7 @@
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -32,7 +32,7 @@
database (e.g. Postgres). Consult the Hibernate documentation to see a list of
available dialects.
-->
<bean id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<!--
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />

View File

@ -17,7 +17,7 @@
</bean>
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEntityManagerFactory" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="myTxManager" />

View File

@ -32,7 +32,7 @@
database (e.g. Postgres). Consult the Hibernate documentation to see a list of
available dialects.
-->
<bean id="myEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myPersistenceDataSource" />
<!--
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />

View File

@ -14,7 +14,7 @@
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>HAPI-FHIR</name>
<url>http://hl7api.sourceforge.net/hapi-fhir/</url>
<url>http://jamesagnew.github.io/hapi-fhir/</url>
<organization>
<name>University Health Network</name>

View File

@ -177,6 +177,12 @@
"forceConformanceCheck()" which manually triggers this check. Thanks to
Doug Martin for reporting and suggesting!
</action>
<action type="add" issue="167">
Rename the Spring Bean definition for the JPA server EntityManager from
"myEntityManagerFactory" to just "entityManagerFactory" as this is the
default bean name expected in other parts of the Spring framework.
Thanks to Mohammad Jafari for the suggestion!
</action>
</release>
<release version="0.9" date="2015-Mar-14">
<action type="add">

View File

@ -9,15 +9,34 @@
<section name="Downloading HAPI FHIR">
<p>
If you are developing applications in Java, the easiest way to use HAPI is
to use a build system which handles dependency management automatically. The
two most common such systems are
<a href="http://maven.apache.org">Apache Maven</a> and
<a href="https://gradle.org/">Gradle</a>. These systems will automatically
download "dependency" libraries and add them to your classpath.
If you are <b>not</b> using one of these systems, you can still manually download
the latest release of HAPI by looking in the
<a href="https://github.com/jamesagnew/hapi-fhir/releases">GitHub Release Section</a>.
</p>
<p>
To use HAPI in your application, at a minimum you need to include the HAPI-FHIR core
JAR <code>hapi-fhir-base-[version].jar</code>, as well as at least one "structures" JAR.
The structures JAR contains classes with the resource and datatype definitions for a given
version of FHIR. At this time, the only official release of FHIR is the "DSTU1" release,
which is available by including the <code>hapi-fhir-structures-dstu-[version].jar</code>.
version of FHIR.
</p>
<p>
If you use Maven, you can include these JARs with the following dependency tags:
At this time, the only official release of FHIR is the "DSTU1" release,
which is available by including the <code>hapi-fhir-structures-dstu-[version].jar</code>.
Note that the ballot process for the next release (DSTU2) has not yet been
completed, but many users are already targeting it for new development as it
is likely to be approved without significant changes.
</p>
<p>
If you use Maven, you can include these JARs with the following dependency tags
to enable DSTU1 support:
</p>
<source><![CDATA[<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
@ -42,7 +61,9 @@
</p>
<p>
If you are using Maven, add the following dependency to include DSTU2 resources:
If you are using Maven, add the following dependency to include DSTU2 resources.
Note that if you do not need to support DSTU1 resources, you do not need to
include the "hapi-fhir-structures-dstu" artifact.
</p>
<source><![CDATA[<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
@ -52,13 +73,22 @@
</subsection>
<subsection name="Non-Maven Users">
<subsection name="Gradle Users">
<p>
Non-maven users can grab the binary releases from the
<a href="https://github.com/jamesagnew/hapi-fhir/releases">GitHub Release Section</a>.
If you are using Gradle, you may use the following dependencies. Note that if
you are doing Android development, you may want to use our
<a href="./doc_android.html">Android build</a> instead.
</p>
<p>
DSTU1:
</p>
<source><![CDATA[compile 'ca.uhn.hapi.fhir:hapi-fhir-base:${hapi_stable_version}'
compile 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu:${hapi_stable_version}']]></source>
<p>
DSTU2:
</p>
<source><![CDATA[compile 'ca.uhn.hapi.fhir:hapi-fhir-base:${hapi_stable_version}'
compile 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:${hapi_stable_version}']]></source>
</subsection>
</section>
@ -69,21 +99,34 @@
Snapshot builds of HAPI are pre-release builds which can contain
fixes and new features not yet released in a formal release. To use
snapshot builds of HAPI you may need to add a reference to the OSS snapshot
repository to your project pom.xml:
repository to your project build file.
</p>
<p>
<b>Using Maven:</b>
</p>
<source><![CDATA[<repositories>
<repository>
<id>oss-snapshots</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>oss-snapshots</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>]]></source>
<p>
Non Maven users can often also find snapshot builds in the Maven repository
<b>Using Gradle:</b>
</p>
<source><![CDATA[repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}]]></source>
<p>
<b>Non Maven users</b> can often also find snapshot builds in the Maven repository
manually by searching
<a href="https://oss.sonatype.org/content/repositories/snapshots/ca/uhn/hapi/fhir/">here</a>.
</p>