You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I noticed a problem that when I am not manually using entityManager.flush() below, the result i got for tableNo in return statement and what I have in the database(which got the data updated) is different. For example, my input for tableNo is "a b c" and my expected result both for in database and the return is "abc". However I only have "abc" in the database and still "a b c" in the return statement. When I uncomment the entityManager.flush() things work perfectly, but do I have to do so since the flush() should be automatically done?
@TransactionalpublicSeat.SeatResponseDTOupdateSeat(Longid, Seat.SeatRequestDTOrequestDTO) {
Seatseat = getSeatById(id); //which calledif (!seat.getTableNo().equals(requestDTO.getTableNo())) {
if (seatRepository.existsByTableNo(requestDTO.getTableNo())) {
thrownewIllegalArgumentException("Table number already exists");
}
seat.setTableNo(requestDTO.getTableNo());
}
seat.setDescription(requestDTO.getDescription());
seat.setStatus(TableStatus.fromString(requestDTO.getStatus()));
/** * bug, this should be automatically called but i have to do it manually to achieve something obvious */entityManager.flush();
returnSeat.SeatResponseDTO.builder()
.tableNo(seat.getTableNo())
.description(seat.getDescription())
.status(seat.getStatus())
.build();
}
The text was updated successfully, but these errors were encountered:
Hi, I noticed a problem that when I am not manually using entityManager.flush() below, the result i got for tableNo in return statement and what I have in the database(which got the data updated) is different. For example, my input for tableNo is "a b c" and my expected result both for in database and the return is "abc". However I only have "abc" in the database and still "a b c" in the return statement. When I uncomment the entityManager.flush() things work perfectly, but do I have to do so since the flush() should be automatically done?
Seat.java
SeatService.java
The text was updated successfully, but these errors were encountered: