/**
* @return the number of entities in the table.
*/
public long getCount()
{
String entityName = entityClass.getSimpleName();
Table annotation = entityClass.getAnnotation(Table.class);
String tableName;
if (annotation != null)
{
tableName = annotation.name();
}
else
{
tableName = entityName;
}
String qry = "select count(" + entityName + ") from " + tableName + " " + entityName;
Query query = getEntityManager().createQuery(qry);
Number countResult = (Number) query.getSingleResult();
return countResult.longValue();
}
JpaBaseDao.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:VaadinUtils
作者:
评论列表
文章目录