Skip to content

Commit

Permalink
Orderying temperatures by time
Browse files Browse the repository at this point in the history
  • Loading branch information
kbl committed Jun 10, 2017
1 parent c200f09 commit 7b8a728
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -12,8 +12,6 @@
import javax.persistence.EntityManager;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

@Service
public class TemperatureServiceImpl implements TemperatureService {
Expand Down Expand Up @@ -85,9 +83,7 @@ public List transformList(List collection) {

@Override
public List<TemperatureMeasurement> getTemperatures() {
return StreamSupport
.stream(temperatureDAO.findAll().spliterator(), false)
.collect(Collectors.toList());
return temperatureDAO.findAllByOrderByWhenMeasuredAsc();
}

}
Expand Up @@ -3,7 +3,11 @@
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TemperatureMeasurementDAO extends CrudRepository<TemperatureMeasurement, Long> {

List<TemperatureMeasurement> findAllByOrderByWhenMeasuredAsc();

}

0 comments on commit 7b8a728

Please sign in to comment.