我正在努力提高我在 Java EE 方面的技能
我尝试使用我在这里找到的这个查询
SELECT COUNT(e) FROM Object e WHERE TYPE(e) <> Country
我这样用
TypedQuery<String> query=(TypedQuery<String>) manager.createQuery
( "SELECT COUNT(e) FROM Object e WHERE TYPE(e) <> Country");
List list=query.getResultList();
for(Object entity : list)
System.out.println(entity);
但我得到这个错误
Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: FROM near line 1, column 17 [SELECT COUNT(e) FROM Object e WHERE TYPE(e) <> Country]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1374)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1315)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:280)
有人知道如何纠正吗?