package nl.homeserver.energie;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

@Transactional
public interface VerbruikRepository extends JpaRepository<Meterstand, Long> {

    @Query(value = "SELECT (MAX(stroom_tarief2) - MIN(stroom_tarief2)) FROM meterstand WHERE date_time >= :van AND date_time < :tot", nativeQuery = true)
    BigDecimal getStroomVerbruikNormaalTariefInPeriod(@Param("van") LocalDateTime van, @Param("tot") LocalDateTime tot);

    @Query(value = "SELECT (MAX(stroom_tarief1) - MIN(stroom_tarief1)) FROM meterstand WHERE date_time >= :van AND date_time < :tot", nativeQuery = true)
    BigDecimal getStroomVerbruikDalTariefInPeriod(@Param("van") LocalDateTime van, @Param("tot") LocalDateTime tot);

    @Query(value = "SELECT MAX(gas) - MIN(gas) FROM meterstand WHERE date_time >= :van AND date_time < :tot", nativeQuery = true)
    BigDecimal getGasVerbruikInPeriod(@Param("van") LocalDateTime van, @Param("tot") LocalDateTime tot);
}

@@ -83,24 +83,58 @@
 lDateTime;%0A%0A
+import javax.annotation.Nullable;%0A
 import javax
@@ -161,16 +161,16 @@
 tional;%0A
-
 %0Aimport 
@@ -429,16 +429,30 @@
 ong%3E %7B%0A%0A
+    @Nullable%0A
     @Que
@@ -711,32 +711,46 @@
 DateTime tot);%0A%0A
+    @Nullable%0A
     @Query(value
@@ -1001,24 +1001,38 @@
 Time tot);%0A%0A
+    @Nullable%0A
     @Query(v

Add nullable annotations