We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
it is weird... very random. To revisit later.
The text was updated successfully, but these errors were encountered:
Controller:
transactionService.batchUpdateCategory(categoryId, transactionsId, pageNumber, pageSize);
Sorry, something went wrong.
Working code on commit fd102b9
// MANIPULATION @Transactional public void batchUpdateCategory(Long categoryId, List<Long> transactionIds /// DELETED..................................... , int pageNumber, int pageSize //............................................................. ) { CategoryEntity category = categoryRepository.findById(categoryId) .orElseThrow(() -> new RuntimeException("Category not found with id " + categoryId)); /// DELETED..................................... int startIndex = pageNumber * pageSize; int endIndex = Math.min(startIndex + pageSize, transactionIds.size()); List<Long> paginatedTransactionIds = transactionIds.subList(startIndex, endIndex); //............................................................. List<TransactionEntity> transactions = transactionRepository.findAllById(paginatedTransactionIds); log.info("....transactions updated: " + transactions.size()); for (TransactionEntity transaction : transactions) { transaction.getCategories().clear(); transaction.addCategory(category); transactionRepository.save(transaction); } }
immarisabel
No branches or pull requests
it is weird... very random.
To revisit later.
The text was updated successfully, but these errors were encountered: