我正在学习Hibernate。我想连接SQL服务器。我写了这段代码,我收到一个异常
SessionFactory factory = new Configuration()
.configure("hibernate.cfg.xml")
.addAnnotatedClass(Car.class)
.buildSessionFactory();
Session session = factory.getCurrentSession();
try {
session.beginTransaction();
List<Car> cars = session.createQuery("from cars").getResultList();
for (Car car : cars) {
System.out.println(car.getCars_name());
}
session.getTransaction().commit();
} finally {
factory.close();
}
无法访问javax.persistence.criterial.CriteriaDelete类文件,找不到javax.persistence.criterial.CriteriaDelete类文件
1条答案
按热度按时间yv5phkfx1#
我以为依赖是缺失的: