Try to use the following approach (it works for me):
@Query("SELECT u.username FROM User u WHERE u.username LIKE CONCAT('%',:username,'%')")
List<String> findUsersWithPartOfName(@Param("username") String username);
Notice: The table name in JPQL must start with a capital letter.
More Related Contents:
- JQuery, Spring MVC @RequestBody and JSON – making it work together
- How to execute IN() SQL queries with Spring’s JDBCTemplate effectively?
- How to return a custom object from a Spring Data JPA GROUP BY query
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- Spring Boot, Spring Data JPA with multiple DataSources
- Using generics in Spring Data JPA repositories
- What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?
- Handling soft-deletes with Spring JPA
- Persistence unit as RESOURCE_LOCAL or JTA?
- @Transactional method called from another method doesn’t obtain a transaction
- Http Post request with content type application/x-www-form-urlencoded not working in Spring
- Implementing custom methods of Spring Data repository and exposing them through REST
- Spring – Is it possible to use multiple transaction managers in the same application?
- Why does Hibernate disable INSERT batching when using an IDENTITY identifier generator
- Spring-Data FETCH JOIN with Paging is not working
- Change database schema during runtime based on logged in user
- Why use returned instance after save() on Spring Data JPA Repository?
- Use abstract super class as parameter for Spring data repository
- How to use @Transactional with Spring Data?
- How to map sql native query result into DTO in spring jpa repository?
- Spring-boot: required a bean named ‘entityManagerFactory’ that could not be found
- JPA using multiple database schemas
- Iterating through a List Object in JSP
- java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
- Injecting EntityManager Vs. EntityManagerFactory
- DAO and Service layers (JPA/Hibernate + Spring) [duplicate]
- java.lang.IllegalStateException: No transactional EntityManager available
- FetchMode join makes no difference for ManyToMany relations in spring JPA repositories
- How to find distinct rows with field in list using JPA and Spring?
- Does JPA support mapping to sql views?