schema
<class name="UserStats" table="UserStats">
<id type="long" name="id" column="ID">
<meta attribute="scope-set">protected</meta>
<generator class="increment" />
</id>
<version column="VERSION" name="version" type="integer">
<meta attribute="scope-set">protected</meta>
<meta attribute="scope-get">protected</meta>
</version>
<property type="int" name="pointsBalance" column="POINTS_BALANCE"/>
</class>
code:
Code:
EntityManager em = getEntityManager();
CriteriaBuilder cb = em.getCriteriaBuilder();
...
Code:
cb.createQuery(UserStats.class).from(UserStats.class).get("pointsBalance")
returns a Path object as expected
Code:
cb.createQuery(UserStats.class).from(UserStats.class).get("id")
throws
java.lang.NullPointerException
at org.hibernate.ejb.criteria.path.AbstractPathImpl.unknownAttribute(AbstractPathImpl.java:110)
at org.hibernate.ejb.criteria.path.AbstractPathImpl.locateAttribute(AbstractPathImpl.java:218)
at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:189)
what could be my mistake?