how to get list of long values in hibernate from the table while casting from bigint to long
- 阅读更多 关于 how to get list of long values in hibernate from the table while casting from bigint to long
问题 I get the following exception when using the getEvents method: org.hibernate.MappingException: Unknown entity: java.lang.Long public List<Long> getEvents(Person person) { String q = "select new java.lang.Long(te.event_id) " + "from teachers_event te" + "where te.teachers_id = :personId "; Query query = entityManager.createNativeQuery(q, Long.class); query.setParameter("personId", person.getId()); return (List<Long>) query.getResultList(); } The teachers_event table in database connects the id