Cần giúp đỡ về xử lý giá trị boolean

đáp nào đúng thì hiện thị lại đúng như ảnh.
nhưng ở bên server em out.print ra thì nó báo là false là em sai ở đâu ạ

đoạn này là em lấy đáp án từ db về

if(instance.getQuestionId()!=null){
		listAnswerSelect.clear();
		Questions q=getEntityManager().find(Questions.class, instance.getQuestionId());
		setInstance(q);
		List<Answers> list=getEntityManager().createQuery("from Answers answer where answer.questions.questionId="+instance.getQuestionId()).getResultList();
		for (Answers answers : list) {
			System.out.print(answers.getCorrect()); // chỗ này in ra tất cả đáp án đều báo là false
			if(!listAnswerSelect.contains(answers)){
				listAnswerSelect.add(answers);
			}
		}
	}

đây là dữ liệu trong db

Bạn thử print kết quả list xem, nếu chứa kết quả đúng thì for của bạn không đúng và ngược lại

2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?