Commit d5c6b130 authored by Matija Obreza's avatar Matija Obreza

Upgraded spring-data-jpa and hibernate

parent 5196b57d
......@@ -29,8 +29,8 @@
<servlet-api.version>2.5</servlet-api.version>
<jsp-api.version>2.1</jsp-api.version>
<hibernate.version>4.2.1.Final</hibernate.version>
<hibernate.annotations.version>4.0.1.Final</hibernate.annotations.version>
<hibernate.version>4.2.7.SP1</hibernate.version>
<hibernate.annotations.version>4.0.4.Final</hibernate.annotations.version>
<hsqldb.version>2.2.9</hsqldb.version>
<ehcache.version>2.7.0</ehcache.version>
......@@ -42,7 +42,7 @@
<spring.security.version>3.1.4.RELEASE</spring.security.version>
<spring.security.oauth2.version>1.0.5.RELEASE</spring.security.oauth2.version>
<spring.data.core.version>1.5.1.RELEASE</spring.data.core.version>
<spring.data.jpa.version>1.3.2.RELEASE</spring.data.jpa.version>
<spring.data.jpa.version>1.3.5.RELEASE</spring.data.jpa.version>
<mysql.version>5.1.25</mysql.version>
......
......@@ -37,15 +37,15 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query("select count(a) from Accession a where a.institute = ?1")
long countByInstitute(FaoInstitute institute);
@Query("select t.genus, count(a) from Accession a inner join a.taxonomy t where a.institute = ?1 group by t.genus order by count(a) desc")
@Query(value = "select t.genus, count(a.id) from Accession a inner join a.taxonomy t where a.institute = ?1 group by t.genus order by count(a) desc", countQuery = "select count(distinct a.taxonomy.genus) from Accession a where a.institute = ?1")
Page<Object[]> statisticsGenusInInstitute(FaoInstitute institute, Pageable pageable);
@Query("select taxonomy, count(a) from Accession a where a.institute = ?1 group by a.taxonomy order by count(a) desc")
@Query(value = "select t, count(a) from Accession a inner join a.taxonomy t where a.institute = ?1 group by a.taxonomy order by count(a) desc", countQuery = "select count(distinct a.taxonomy) from Accession a where a.institute = ?1")
Page<Object[]> statisticsTaxonomyInInstitute(FaoInstitute institute, Pageable pageable);
// FIXME Slow query
@Query("select ct.crop, count(a) from Accession a join a.taxonomy t join t.cropTaxonomies ct where a.institute = ?1 group by ct.crop order by count(a) desc")
@Query(value = "select ct.crop, count(a) from Accession a inner join a.taxonomy t join t.cropTaxonomies ct where a.institute = ?1 group by ct.crop order by count(a) desc", countQuery = "select count(distinct ct.crop) from Accession a inner join a.taxonomy t join t.cropTaxonomies ct where a.institute = ?1")
Page<Object[]> statisticsCropInInstitute(FaoInstitute institute, Pageable pageable);
@Query("select count(a) from Accession a where a.origin = ?1")
......@@ -60,13 +60,13 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query("select a from Accession a where a.genus in ( ?1 )")
Page<Accession> findByGenus(List<String> genus, Pageable pageable);
@Query("select a.institute, count(a) as total from Accession a where a.genus in ( ?1 ) group by a.institute order by total desc")
@Query("select a.institute, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.institute order by total desc")
List<Object[]> statisticsInstitute(List<String> genus);
@Query("select a.origin, count(a) as total from Accession a where a.genus in ( ?1 ) group by a.origin order by total desc")
@Query("select a.origin, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.origin order by total desc")
List<Object[]> statisticsOrigin(List<String> genus);
@Query("select a.taxonomy, count(a) as total from Accession a where a.genus in ( ?1 ) group by a.taxonomy order by total desc")
@Query("select a.taxonomy, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.taxonomy order by total desc")
List<Object[]> statisticsTaxonomy(List<String> genus);
// List<Accession> findByOrigin(String origin);
......@@ -88,7 +88,8 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query("select a from Accession a where a.taxonomy in ( ?1 )")
Page<Accession> findByTaxonomy(Collection<Taxonomy> taxonomies, Pageable pageable);
// Accession findByInstituteCodeAndAccessionName(String holdingInstitute, String accessionName);
// Accession findByInstituteCodeAndAccessionName(String holdingInstitute,
// String accessionName);
Accession findByInstituteCodeAndAccessionNameAndGenus(String holdingInstitute, String accessionName, String genus);
......
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