0
데이터베이스에서 데이터를 가져 오는 중 테이블에 6 개의 행이 있지만 프로그램의 출력이 표시되지 않습니다. 내 코드가 아래에 어떤 문제가있을 수 있습니다. 콘솔에 오류가 표시되지 않습니다.테이블에서 행을 반환하지 않음
public class smsDAO {
Session session = HibernateUtil.getSessionFactory().openSession();
public List<SmsGateway> fetchAll() {
System.out.println("Calling fetchA b");
Transaction tx = session.beginTransaction();
List<SmsGateway> sms = null;
try {
sms = session.createQuery("FROM sms_gateway").list();
tx.commit();
for (SmsGateway s : sms) {
System.out.println(s.getDescription() + " " + s.getUrl1());
}
} catch (HibernateException e) {
if (tx != null) {
tx.rollback();
}
} finally {
session.close();
}
System.out.println("Calling fetchA re ");
return sms;
}
}
"sms_gateway"는 자바 클래스 또는 DB 테이블의이 이름입니까? – mahesh
db 클래스 이름. – xrcwrn