تخطَّ إلى المحتوى

Unbounded Query No Limit (ARCH4061)

هذا المحتوى غير متوفر بلغتك بعد.

Key java.orm.unbounded-query-no-limit · Severity warning · Category orm

Fetching an entire table with no LIMIT/pagination risks a memory blowup as the table grows. Paginate the result with Pageable.

List<Event> events = eventRepository.findAll(); // millions of rows
return events;
Page<Event> events = eventRepository.findAll(PageRequest.of(0, 50));
return events.getContent();

Add Pageable or an explicit LIMIT to queries that feed a list/response.