Answer the question
In order to leave comments, you need to log in
How to make sql query in Spring Data JPA?
Greetings dear forum users.
I have a question.
I am using IntelliJ IDEA.
I made such a request:
In this form, this request works. But the fact that the String type is highlighted in yellow somehow confuses me. I thought that if you specify String instead of User in JpaRepository, this seems to be correct and the yellow highlight disappears, but the request itself stops working, an error message appears " Not a managed type: class java.lang.String "
Please tell me what is wrong am I doing?
Answer the question
In order to leave comments, you need to log in
As answered above, if you want a pure sql query, you can also write in jdbcTemplate.NativeQuery when there are not enough JPQL capabilities. As far as I know, repository methods (without sql query) can get an object and lists of objects, so in this case you can’t do without a query.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question