spring-projects / spring-projects/spring-data-relational

How to skip mybatis method lookup when extends MybatisMapper

Open
#1,312 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

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")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the @EnableJdbcRepositories examples and the PropertyReferenceException as entry points; inspect how methods inherited from SysUserMapper are considered during repository query derivation. Done means a repository can extend both interfaces without treating selectAll and selectFullName as derived Spring Data JDBC queries, with the supplied configuration behavior covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.