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

FIX NPE in statisticsSpeciesByInstitute

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