Commit 06da4682 authored by Matija Obreza's avatar Matija Obreza

Unhappy jackson-datatype-hibernate4 module

- temporary using a custom build
- https://github.com/FasterXML/jackson-datatype-hibernate/pull/126
parent 637459c2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
<version>2.9.8</version>
</parent>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate-parent</artifactId>
<name>Hibernate module parent</name>
<version>2.9.9-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Parent pom for shared settings for project sub-modules
</description>
<modules>
<module>hibernate3</module>
<module>hibernate4</module>
<module>hibernate5</module>
<!--
<module>hibernate5_2-test</module>
-->
</modules>
<url>https://github.com/FasterXML/jackson-datatype-hibernate</url>
<scm>
<connection>scm:git:git@github.com:FasterXML/jackson-datatype-hibernate.git</connection>
<developerConnection>scm:git:git@github.com:FasterXML/jackson-datatype-hibernate.git</developerConnection>
<url>http://github.com/FasterXML/jackson-datatype-hibernate</url>
<tag>HEAD</tag>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- But there are also some well-known test dependencies we may as well add directly -->
<!-- and for testing, JUnit is needed, as well as annotations -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Alas, need to include snapshot reference since otherwise can not find
snapshot of parent... -->
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>com/fasterxml/jackson/**/failing/*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate-parent</artifactId>
<version>2.9.9-SNAPSHOT</version>
</parent>
<artifactId>jackson-datatype-hibernate4</artifactId>
<name>Jackson-datatype-Hibernate4</name>
<packaging>bundle</packaging>
<description>Add-on module for Jackson (http://jackson.codehaus.org) to support
Hibernate (http://hibernate.org) version 4.x data types.
</description>
<url>https://github.com/FasterXML/jackson-datatype-hibernate</url>
<properties>
<!-- Generate PackageVersion.java into this directory. -->
<packageVersion.dir>com/fasterxml/jackson/datatype/hibernate4</packageVersion.dir>
<packageVersion.package>${project.groupId}.hibernate4</packageVersion.package>
<!-- Hibernate with JPA 2.0 -->
<hibernate.version>4.1.0.Final</hibernate.version>
<surefire.version>2.12</surefire.version>
<osgi.export>${project.groupId}.hibernate4</osgi.export>
</properties>
<dependencies>
<!-- what would be the best scope to use here? -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.155</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>process-packageVersion</id>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
......@@ -91,7 +91,7 @@
<hazelcast.version>3.8.1</hazelcast.version>
<oval.version>1.81</oval.version>
<jackson.version>2.9.6</jackson.version>
<jackson.version>2.9.8</jackson.version>
<jaxb-api.version>2.2.12</jaxb-api.version>
<liquibase.version>3.6</liquibase.version>
<swagger.version>2.9.2</swagger.version>
......@@ -236,7 +236,7 @@
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate4</artifactId>
<version>${jackson.version}</version>
<version>2.9.9-SNAPSHOT</version>
</dependency>
......@@ -975,6 +975,10 @@
</build>
<repositories>
<repository>
<id>my-local-repo</id>
<url>file://${basedir}/lib</url>
</repository>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
......
......@@ -38,6 +38,7 @@ import org.genesys.worldclim.WorldClimUtil;
import org.genesys2.server.model.impl.GeoReferencedEntity;
import org.genesys2.server.model.impl.TileClimate;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonView;
......@@ -181,6 +182,7 @@ public class AccessionGeo extends BasicModel implements GeoReferencedEntity, Acc
this.climate = climate;
}
@JsonIgnore
public boolean isEmpty() {
if (StringUtils.isNotBlank(datum)) {
return false;
......
......@@ -198,7 +198,8 @@ public class ElasticsearchConfig {
Hibernate4Module hibernateModule = new Hibernate4Module();
hibernateModule.enable(Feature.FORCE_LAZY_LOADING);
hibernateModule.disable(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS);
hibernateModule.enable(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS);
hibernateModule.enable(Feature.WRITE_MISSING_ENTITIES_AS_NULL);
mapper.registerModule(hibernateModule);
// deserialization
......@@ -223,7 +224,7 @@ public class ElasticsearchConfig {
@Override
public String mapToString(final Object object) throws IOException {
String x = mapper.writeValueAsString(object);
System.err.println(x);
// System.err.println(x);
return x;
}
......
......@@ -15,9 +15,9 @@
*/
package org.genesys.test.server.services;
import static com.google.common.collect.Sets.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static com.google.common.collect.Sets.newHashSet;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import java.util.List;
import java.util.Map;
......@@ -43,7 +43,6 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.ArrayNode;
......@@ -97,7 +96,13 @@ public class ElasticQueryBuilderTest extends AbstractElasticServiceTest {
batch.add(makeAccessionJson(institute, "ACCE 1000", "Manihot", newHashSet(MCPD_STORAGE_INVITRO, MCPD_STORAGE_FIELD)));
batch.add(makeAccessionJson(institute, "M 1001", "Musa", newHashSet(MCPD_STORAGE_INVITRO)));
batch.add(makeAccessionJson(institute, "M 1002", "Musa", newHashSet(MCPD_STORAGE_CRYO, MCPD_STORAGE_FIELD)));
batch.add(makeAccessionJson(institute, "ACCE 1003", "Dioscorea", newHashSet(MCPD_STORAGE_FIELD)));
// Generate accessionGeo#tileIndex that triggers https://github.com/FasterXML/jackson-datatype-hibernate/issues/125
ObjectNode x = makeAccessionJson(institute, "ACCE 1003", "Dioscorea", newHashSet(MCPD_STORAGE_FIELD));
ObjectNode geo = x.putObject("geo");
geo.put("latitude", 30f);
geo.put("longitude", 15f);
batch.add(x);
accessionUploader.upsertAccessions(institute, batch);
assertThat(accessionRepository.count(), is((long) batch.size()));
......@@ -115,7 +120,7 @@ public class ElasticQueryBuilderTest extends AbstractElasticServiceTest {
} while (count != batch.size());
}
private JsonNode makeAccessionJson(FaoInstitute institute, String acceNumb, String genus, Set<Integer> storage) {
private ObjectNode makeAccessionJson(FaoInstitute institute, String acceNumb, String genus, Set<Integer> storage) {
ObjectNode a = objectMapper.createObjectNode();
a.put("instituteCode", institute.getCode());
a.put("accessionNumber", acceNumb);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment