Created
January 3, 2023 05:59
-
-
Save Elyorbe/aba7f0fb874658fbfd064164374310f0 to your computer and use it in GitHub Desktop.
MyBatis and Spring Data JDBC. Check out `@EnableJdbcRepositories`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository | |
public class RoleRepository { | |
private MyBatisMapper mapper; | |
private RoleCrudRepository crud; | |
@Mapper | |
public interface MyBatisMapper { | |
Optional<Role> selectByDescription(); | |
} | |
@Repository | |
interface RoleCrudRepository extends CrudRepository<Role, Integer> { | |
} | |
RoleRepository(MyBatisMapper mapper, RoleCrudRepository crud) { | |
this.mapper = mapper; | |
this.crud = crud; | |
} | |
public MyBatisMapper mapper() { | |
return mapper; | |
} | |
public RoleCrudRepository crud() { | |
return crud; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment