package au.gov.ga.geodesy.domain.model;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

import org.springframework.beans.factory.annotation.Autowired;

import au.gov.ga.support.Json;

public class SetupRepositoryImpl implements SetupRepositoryCustom {

    @Autowired
    private SetupRepository setups;

    @PersistenceContext(unitName = "geodesy")
    private EntityManager entityManager;

    public Setup findCurrentBySiteId(Integer siteId) {
        String queryString =
            "select s from Setup s where s.siteId = :id and s.effectivePeriod.to is null";

        TypedQuery<Setup> query = entityManager.createQuery(queryString, Setup.class);


        System.out.println(siteId);
        System.out.println(siteId);
        System.out.println(siteId);
        System.out.println(siteId);
        System.out.println(siteId);
        System.out.println(siteId);
        System.out.println(siteId);

        for (Setup s : setups.findAll()) {
            System.out.println(Json.toString(s));
        }

        query.setParameter("id", siteId);
        return query.getSingleResult();
    }
}

@@ -225,40 +225,8 @@
 d;%0A%0A
-import au.gov.ga.support.Json;%0A%0A
 publ
@@ -697,367 +697,8 @@
 s);%0A
-%0A%0A        System.out.println(siteId);%0A        System.out.println(siteId);%0A        System.out.println(siteId);%0A        System.out.println(siteId);%0A        System.out.println(siteId);%0A        System.out.println(siteId);%0A        System.out.println(siteId);%0A%0A        for (Setup s : setups.findAll()) %7B%0A            System.out.println(Json.toString(s));%0A        %7D%0A%0A
     

Tidy up.