Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于springboot2.1集成entitymanager的问题 #1

Open
xiaobu1994 opened this issue Nov 30, 2018 · 1 comment
Open

关于springboot2.1集成entitymanager的问题 #1

xiaobu1994 opened this issue Nov 30, 2018 · 1 comment

Comments

@xiaobu1994
Copy link

protected final JpaRepositoryImplementation getTargetRepository(RepositoryInformation information) {
JpaRepositoryImplementation repository = this.getTargetRepository(information, this.entityManager);
repository.setRepositoryMethodMetadata(this.crudMethodMetadataPostProcessor.getCrudMethodMetadata());
return repository;
}

protected JpaRepositoryImplementation<?, ?> getTargetRepository(RepositoryInformation information, EntityManager entityManager) {
    JpaEntityInformation<?, Serializable> entityInformation = this.getEntityInformation(information.getDomainType());
    Object repository = this.getTargetRepositoryViaReflection(information, new Object[]{entityInformation, entityManager});
    Assert.isInstanceOf(JpaRepositoryImplementation.class, repository);
    return (JpaRepositoryImplementation)repository;
}

这个版本是final了 该如何处理

@gangyahaidao
Copy link

使用这个方法来覆盖
@Override protected BaseRepositoryImpl getTargetRepository(RepositoryInformation information, EntityManager entityManager) { return new BaseRepositoryImpl<T, I>((Class<T>) information.getDomainType(), entityManager); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants