spring-data-relational
spring-data-relational copied to clipboard
How to skip mybatis method lookup when extends MybatisMapper
Mybatis mapper:
@Mapper
public interface SysUserMapper {
@Transactional(readOnly = true)
List<SysUserFullNamePj> selectFullName();
@Transactional(readOnly = true)
List<SysUser> selectAll();
}
Spring Data JDBC:
@Repository
public interface SysUserRepo extends PagingAndSortingRepository<SysUser, Long>, SysUserMapper {
Optional<SysUser> findFirstByUsernameEqualsIgnoreCase(String username);
}
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property 'selectAll' found for type 'SysUser'
Example:
@EnableJdbcRepositories(excludeNamedQueriesStartWith = "select")
@EnableJdbcRepositories(mybatisMethodPrefix = "select")
This could be handled similar to named queries where we try to look up the query in MyBatis before trying to resolve it with query derivation inside Spring Data.