Better logging in JPA

This commit is contained in:
James Agnew 2014-12-23 09:42:16 -05:00
parent c1d94ed496
commit c8adab5452
14 changed files with 79 additions and 46 deletions

View File

@ -88,12 +88,12 @@
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.9</version> <version>${commons_codec_version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.4</version> <version>${commons_io_version}</version>
</dependency> </dependency>
<!-- Logging --> <!-- Logging -->
@ -118,7 +118,7 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.3.3</version> <version>${apache_httpclient_version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>commons-logging</artifactId> <artifactId>commons-logging</artifactId>
@ -129,7 +129,7 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId> <artifactId>httpcore</artifactId>
<version>4.3.2</version> <version>${apache_httpcore_version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -26,15 +26,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/classes" path="target/generated-sources/tinder">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="target/generated-resources/tinder">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -2,7 +2,5 @@
<wb-module deploy-name="hapi-fhir-jpaserver-base"> <wb-module deploy-name="hapi-fhir-jpaserver-base">
<wb-resource deploy-path="/" source-path="/src/main/java"/> <wb-resource deploy-path="/" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/resources"/> <wb-resource deploy-path="/" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/generated-sources/tinder"/>
<wb-resource deploy-path="/" source-path="/target/generated-resources/tinder"/>
</wb-module> </wb-module>
</project-modules> </project-modules>

View File

@ -263,7 +263,7 @@
<plugin> <plugin>
<groupId>de.juplo</groupId> <groupId>de.juplo</groupId>
<artifactId>hibernate4-maven-plugin</artifactId> <artifactId>hibernate4-maven-plugin</artifactId>
<version>1.0.2</version> <version>1.0.5</version>
<configuration> <configuration>
<force>true</force> <force>true</force>
<target>SCRIPT</target> <target>SCRIPT</target>

View File

@ -743,8 +743,25 @@ public abstract class BaseFhirDao implements IDao {
} }
IParser parser = theEntity.getEncoding().newParser(getContext(theEntity.getFhirVersion())); IParser parser = theEntity.getEncoding().newParser(getContext(theEntity.getFhirVersion()));
T retVal = parser.parseResource(theResourceType, resourceText); T retVal;
try {
retVal = parser.parseResource(theResourceType, resourceText);
} catch (Exception e) {
StringBuilder b = new StringBuilder();
b.append("Failed to parse database resource[");
b.append(theResourceType);
b.append("/");
b.append(theEntity.getIdDt().getIdPart());
b.append(" (pid ");
b.append(theEntity.getId());
b.append(", version ");
b.append(myContext.getVersion().getVersion());
b.append("): ");
b.append(e.getMessage());
String msg = b.toString();
ourLog.error(msg, e);
throw new DataFormatException(msg, e);
}
IResource res = (IResource) retVal; IResource res = (IResource) retVal;
res.setId(theEntity.getIdDt()); res.setId(theEntity.getIdDt());

View File

@ -107,6 +107,8 @@ public abstract class BaseHasResource {
myDeleted = theDate; myDeleted = theDate;
} }
public abstract Long getId();
public void setEncoding(ResourceEncodingEnum theEncoding) { public void setEncoding(ResourceEncodingEnum theEncoding) {
myEncoding = theEncoding; myEncoding = theEncoding;
} }

View File

@ -67,6 +67,10 @@ public class ResourceHistoryTable extends BaseHasResource implements Serializabl
return historyTag; return historyTag;
} }
public Long getId() {
return myId;
}
@Override @Override
public IdDt getIdDt() { public IdDt getIdDt() {
Object id = getForcedId()==null? getResourceId() : getForcedId().getForcedId(); Object id = getForcedId()==null? getResourceId() : getForcedId().getForcedId();

View File

@ -14,6 +14,9 @@
<dependent-module archiveName="hapi-fhir-structures-dstu-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu"> <dependent-module archiveName="hapi-fhir-structures-dstu-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="hapi-fhir-structures-dev-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dev/hapi-fhir-structures-dev">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type> <dependency-type>consumes</dependency-type>
</dependent-module> </dependent-module>

View File

@ -2,24 +2,29 @@
<wb-module deploy-name="hapi-fhir-jpaserver-uhnfhirtest"> <wb-module deploy-name="hapi-fhir-jpaserver-uhnfhirtest">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-resources/tinder"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-resources/tinder"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/tinder"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<dependent-module archiveName="hapi-fhir-jpaserver-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-structures-dstu-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type>
</dependent-module>
<<<<<<< HEAD <<<<<<< HEAD
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module archiveName="hapi-fhir-jpaserver-base-0.8.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-structures-dstu-0.8.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.8/hapi-fhir-testpage-overlay-0.8.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
======= =======
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.8-SNAPSHOT/hapi-fhir-testpage-overlay-0.8-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module archiveName="hapi-fhir-jpaserver-base-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
>>>>>>> d22a35788f57e9f7ce64bc8afc2ee7eaf29d94f2 <dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-base-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-structures-dstu-0.9-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
>>>>>>> hl7org_structs
<dependency-type>consumes</dependency-type> <dependency-type>consumes</dependency-type>
</dependent-module> </dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF"> <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">

View File

@ -109,7 +109,7 @@
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>17.0</version> <version>${guava_version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -60,19 +60,19 @@
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.4</version> <version>${commons_io_version}</version>
</dependency> </dependency>
<!-- Logging --> <!-- Logging -->
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.6</version> <version>${slf4j_version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>1.1.1</version> <version>${logback_version}</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@ -93,7 +93,7 @@
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId> <artifactId>maven-plugin-api</artifactId>
<version>3.2.1</version> <version>3.2.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.plugin-tools</groupId> <groupId>org.apache.maven.plugin-tools</groupId>

20
pom.xml
View File

@ -136,15 +136,19 @@
<scmPubCheckoutDirectory>${user.home}/sites/scm/hapi-fhir</scmPubCheckoutDirectory> <scmPubCheckoutDirectory>${user.home}/sites/scm/hapi-fhir</scmPubCheckoutDirectory>
<!-- Plugin Versions --> <!-- Plugin Versions -->
<apache_httpclient_version>4.3.6</apache_httpclient_version>
<apache_httpcore_version>4.4</apache_httpcore_version>
<commons_io_version>2.4</commons_io_version>
<commons_lang_version>3.3.2</commons_lang_version> <commons_lang_version>3.3.2</commons_lang_version>
<commons_codec_version>1.10</commons_codec_version>
<derby_version>10.11.1.1</derby_version> <derby_version>10.11.1.1</derby_version>
<guava_version>18.0</guava_version> <guava_version>18.0</guava_version>
<hamcrest_version>1.3</hamcrest_version> <hamcrest_version>1.3</hamcrest_version>
<hibernate_version>4.2.12.Final</hibernate_version> <hibernate_version>4.3.7.Final<!-- 4.2.12.Final --></hibernate_version>
<hibernate_validator_version>5.1.0.Final</hibernate_validator_version> <hibernate_validator_version>5.1.0.Final</hibernate_validator_version>
<jetty_version>9.2.2.v20140723</jetty_version> <jetty_version>9.2.6.v20141205</jetty_version>
<jscience_version>4.3.1</jscience_version> <jscience_version>4.3.1</jscience_version>
<junit_version>4.11</junit_version> <junit_version>4.12</junit_version>
<logback_version>1.1.2</logback_version> <logback_version>1.1.2</logback_version>
<maven_assembly_plugin_version>2.4.1</maven_assembly_plugin_version> <maven_assembly_plugin_version>2.4.1</maven_assembly_plugin_version>
<maven_javadoc_plugin_version>2.10.1</maven_javadoc_plugin_version> <maven_javadoc_plugin_version>2.10.1</maven_javadoc_plugin_version>
@ -153,15 +157,15 @@
<maven_site_plugin_version>3.4</maven_site_plugin_version> <maven_site_plugin_version>3.4</maven_site_plugin_version>
<maven_source_plugin_version>2.3</maven_source_plugin_version> <maven_source_plugin_version>2.3</maven_source_plugin_version>
<mitreid-connect-version>1.1.8</mitreid-connect-version> <mitreid-connect-version>1.1.8</mitreid-connect-version>
<mockito_version>1.9.5</mockito_version> <mockito_version>1.10.17</mockito_version>
<phloc_schematron_version>2.7.1</phloc_schematron_version> <phloc_schematron_version>2.7.1</phloc_schematron_version>
<phloc_commons_version>4.3.3</phloc_commons_version> <phloc_commons_version>4.3.5</phloc_commons_version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servlet_api_version>3.1.0</servlet_api_version> <servlet_api_version>3.1.0</servlet_api_version>
<slf4j_version>1.7.7</slf4j_version> <slf4j_version>1.7.9</slf4j_version>
<spring_version>4.1.0.RELEASE</spring_version> <spring_version>4.1.3.RELEASE</spring_version>
<spring_security_version>3.2.4.RELEASE</spring_security_version> <spring_security_version>3.2.4.RELEASE</spring_security_version>
<thymeleaf-version>2.1.3.RELEASE</thymeleaf-version> <thymeleaf-version>2.1.4.RELEASE</thymeleaf-version>
<ebay_cors_filter_version>1.0.1</ebay_cors_filter_version> <ebay_cors_filter_version>1.0.1</ebay_cors_filter_version>
<woodstox_version>4.4.0</woodstox_version> <woodstox_version>4.4.0</woodstox_version>
</properties> </properties>

View File

@ -80,7 +80,7 @@
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId> <artifactId>thymeleaf</artifactId>
<version>2.1.3.RELEASE</version> <version>2.1.4.RELEASE</version>
</dependency> </dependency>
<!-- Used for CORS support --> <!-- Used for CORS support -->

View File

@ -16,6 +16,16 @@
(e.g. because they don't have a no-argument constructor) in order to (e.g. because they don't have a no-argument constructor) in order to
avoid failing later avoid failing later
</action> </action>
<action type="add">
Bump a few dependency JARs to the latest versions in Maven POM:
<![CDATA[
<ul>
<li>SLF4j (in base module) - Bumped to 1.7.9</li>
<li>Apache HTTPClient (in base module) - Bumped to 4.3.6</li>
<li>Hibernate (in JPA module) - Bumped to 4.3.7</li>
</ul>
]]>
</action>
</release> </release>
<release version="0.8" date="2014-Dec-17"> <release version="0.8" date="2014-Dec-17">
<action type="add"> <action type="add">