Skip to content

Instantly share code, notes, and snippets.

@Elyorbe
Created January 3, 2023 05:59
Show Gist options
  • Save Elyorbe/aba7f0fb874658fbfd064164374310f0 to your computer and use it in GitHub Desktop.
Save Elyorbe/aba7f0fb874658fbfd064164374310f0 to your computer and use it in GitHub Desktop.
MyBatis and Spring Data JDBC. Check out `@EnableJdbcRepositories`
@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