I have a repository class that implements another method to obtain all my clients
@Repository
public class ClienteRepositoryImpl implements ClienteRepository{
private EntityManager em;
@Override
@Transactional(readOnly = true)
public List<ClienteEntity> findAll() {
return em.createQuery("from Cliente").getResultList();
}
}
The problem is that in the line of the return it throws me the following warning
Type safety: The expression of type List needs unchecked conversion to conform to List
I have searched in different places and it is not so clear to me because Java throws this at me. I have also read some questions on the subject in English such as this where it is even recommended to use the @SuppressWarnings (" unchecked ") tag as well as to disable the warnings that they can not be avoided, something that for me is bad practice.
How could I avoid this type of warning without the use of labels like the one mentioned?