String sql = "select o.id,o.nameEng from TbCategories o where o.status='ACT' and o.catType='JOIN_CAT'";查询结果不能转换为TbCategories ,不管查询的字段是否写全没,返回的是object对象,不能转换为具体的对象。而写成select o from entityname o ...就可以强制转换。
String sql = "select o from TbCategories o where o.status='ACT' and o.catType='JOIN_CAT'"; 查询结果能转换为TbCategories
String sql = "select o from TbCategories o where o.status='ACT' and o.catType='JOIN_CAT'"; 查询结果能转换为TbCategories