Relative Content

Tag Archive for springspring-bootjpaspring-data-jpaspring-data

Spring Jpa Repository implement several Entity in one repository

@Repository public interface ConsumptionDataRepository extends JpaRepository<ConsumptionDataEntity,Long> { List<ConsumptionDataEntity> findAllByKey(String key); List<ConsumptionDataEntity> findAllByKeyAndTimestampAfterOrTimestampAndKey(String key, Timestamp from, Timestamp from1, String key1); @Query(value = “SELECT key , MIN(timestamp), MAX(timestamp) FROM public.consumption_data where key in (:hmpidList) and timestamp >= :timestamp GROUP BY key”,nativeQuery = true) List<MinMaxRange> timestampMinMaxRange(@Param(“hmpidList”) List<String> hmpidList, @Param(“timestamp”) Timestamp timestamp); } @Setter @Getter @Builder @AllArgsConstructor @NoArgsConstructor @Entity […]