0
EntityManager em;
em = this.getEntityManager();
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Date> criteria = builder.createQuery(Date.class);
Root<News> newsRoot = criteria.from(News.class);
criteria.select(newsRoot.get(News_.date)).distinct(true);
List<Date> newsList = em.createQuery(criteria).getResultList();
return newsList;

News_.date 不起作用我不知道为什么,但在其他项目中它正在起作用。

错误是我需要为 News_ 创建一个类。但在它工作之前。

有人遇到这个问题吗?

4

1 回答 1

1

I have already solved my problem

In AppData and select NetBeans/. metadata - there is a blank .txt file. This file blocks your classes. So When I delete it. I can now access the classes.

于 2013-07-09T09:24:37.193 回答