i am currently making a website using spring and i stumble upon this basic scenario that i don\'t have any idea on how to solve this specific code: Entity = Optional;
As @kaush-athukorala said, you need just add .get()at the end of RoomEntity roomEntity = roomRepository.findById(roomId); It works
.get()
RoomEntity roomEntity = roomRepository.findById(roomId);
You'll have RoomEntity roomEntity = roomRepository.findById(roomId).get();
RoomEntity roomEntity = roomRepository.findById(roomId).get();