I'm using jpa-named-queries.properties file for writing HQL and native queries for my repository interfaces.
now the problem here is when i write native query, returned values i cant directly cast into Entity as column defined as Long in entity are now changed to BigInteger. PFB
i got the solution also for this to cast native query to my entity but i want my query to stay in jpa-named-queries.properties , i dont want it to hardcode in my DAO implementation.
Query q = getEntityManager().createNativeQuery("select * from todo", Todo.class);
List<Todo> l = q.getResultList();
above code works fine i.e. i can write native query and it will return data in entity format also.
is there any way i can read this query from jpa-named-queries.properties ???
jpa-named-queries.properties file
TodoRepo.getList=select * from todo
TodoRepo.java
@Repository
public interface TodoRepo extends JpaRepository<Todo, Long> {
@Query(nativeQuery = true)
public void getList();
}