不能!
query 并不知道会返回何种类型,只有调用者才知道。如果你讨厌那个警告,你可以加上
@SuppressWarnings("unchecked")
public List <BlogCategory> findBlogCategoriesByAccountId ...
query 并不知道会返回何种类型,只有调用者才知道。如果你讨厌那个警告,你可以加上
@SuppressWarnings("unchecked")
public List <BlogCategory> findBlogCategoriesByAccountId ...
@SuppressWarnings("unchecked")
public List <BlogCategory> findBlogCategoriesByAccountId ...
public List findBlogCategoriesByAccountId
在设计较通用的方法时,最好不要具体指定哪个对象类型,这样有利于扩展...
如果方法为Private,就可以使用泛型,只需要调用者知道存储的是何种类型的元素即可。