1
I’m getting the message "The Annotation @Persistencecontext is disallowed for this Location" when I try to put this annotation in the code, someone knows how I can fix it?
@Stateless
public class ReajusteManager {
public List<PlanoSaudeDTO> listarPlanoSaude() {
@PersistenceContext //Local do erro
EntityManager entityManager;
@SuppressWarnings("unchecked")
List<Object[]> listaValores = (List<Object[]>) entityManager.createNativeQuery(
"SELECT F.NM_FUNCIONARIO\r\n" +
"FROM DBO_DB_RH.VW_funcionario F \r\n" +
"Where rownum <30 \r\n" +
"Order by F.NM_FUNCIONARIO").getResultList();
List<PlanoSaudeDTO> listaPlanoSaudeDTO = new ArrayList<PlanoSaudeDTO>();
System.out.println("aqui");
for (Object[] obj : listaValores) {
PlanoSaudeDTO plano = new PlanoSaudeDTO();
plano.setNomeFuncionario(String.valueOf(obj[0]));
listaPlanoSaudeDTO.add(plano);
}
return listaPlanoSaudeDTO;
}
}
That’s right! Thank you!
– B. Fernandes
@B.Fernandes If this answer solved your problem and there is no doubt left, mark it as accepted by clicking on the left side of the answer.
– Victor Stafusa