@Entity(name = "test_jojo")
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Jojo {

    @Id
    @GeneratedValue
    @Column(name = "jo_id")
    private Long joId;

    @Column
    private LocalDateTime regDate;

}

 

public interface JojoRepository extends JpaRepository<Jojo, Long> {

    List<Jojo> findAllByRegDateBetween(LocalDateTime start, LocalDateTime end);

}

 

 

public void test() {
  LocalDateTime startDatetime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.of(0,0,0));
  LocalDateTime endDatetime = LocalDateTime.of(LocalDate.now(), LocalTime.of(23,59,59));

  jojoRepository.findAllByRegDateBetween(startDatetime, endDatetime));
}

 

+ Recent posts