Skip to content
Advertisement

JPARepository findAllByUsername return null but data exist

I have a simple System ( Controller, Service, Repository ) but even if the data are present on the database the service returns a null value

Data

Domain

Controller

Service

Repository

Advertisement

Answer

Bind parameters should not be wrapped inside quotes. Make sure to remove single quotes around :username.

Correct query would be SELECT * FROM Customer c WHERE username = :username ORDER BY username ASC LIMIT 1

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement