Commit 91b3ef3f authored by Matija Obreza's avatar Matija Obreza
Browse files

FIX NPE in statisticsSpeciesByInstitute

parent 13456547
...@@ -58,7 +58,7 @@ public class Accession extends VersionedAuditedModel { ...@@ -58,7 +58,7 @@ public class Accession extends VersionedAuditedModel {
@JoinColumn(name = "taxonomyId") @JoinColumn(name = "taxonomyId")
private Taxonomy taxonomy1; private Taxonomy taxonomy1;
@ManyToOne(cascade = {}, optional = false) @ManyToOne(cascade = {}, optional = true)
@JoinColumn(name = "taxonomyId2") @JoinColumn(name = "taxonomyId2")
private Taxonomy2 taxonomy; private Taxonomy2 taxonomy;
......
...@@ -366,7 +366,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -366,7 +366,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
public Page<Object[]> statisticsSpeciesByInstitute(FaoInstitute institute, Pageable pageable) { public Page<Object[]> statisticsSpeciesByInstitute(FaoInstitute institute, Pageable pageable) {
Page<Object[]> page = accessionRepository.statisticsSpeciesInInstitute(institute, pageable); Page<Object[]> page = accessionRepository.statisticsSpeciesInInstitute(institute, pageable);
for (Object[] r : page.getContent()) { for (Object[] r : page.getContent()) {
r[0] = taxonomyService.get((Long) r[0]); if (r[0] != null)
r[0] = taxonomyService.get((Long) r[0]);
} }
return page; return page;
} }
......
Supports Markdown
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