小编Jas*_*son的帖子

创建基本存储库类时出错

import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.QueryDslJpaRepository;
import org.springframework.data.querydsl.EntityPathResolver;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.EntityManager;

@NoRepositoryBean
public class RepositorySupportImpl<T> extends QueryDslJpaRepository<T, Integer> implements RepositorySupport<T> {

    private EntityManager entityManager;


    public RepositorySupportImpl(JpaEntityInformation<T, Integer> entityInformation, EntityManager entityManager, EntityManager entityManager1) {
    super(entityInformation, entityManager);
    this.entityManager = entityManager1;
    }

    public RepositorySupportImpl(JpaEntityInformation<T, Integer> entityInformation, EntityManager entityManager, EntityPathResolver resolver, EntityManager entityManager1) {
    super(entityInformation, entityManager, resolver);
    this.entityManager = entityManager1;
    }

    @Override
    public EntityManager getEntityManager() {
    return this.entityManager;
    }

@Transactional
@Override
public <S extends T> S save(final S entity) {
    this.getEntityManager().persist(entity);
    return entity; …
Run Code Online (Sandbox Code Playgroud)

spring-mvc

2
推荐指数
1
解决办法
1797
查看次数

标签 统计

spring-mvc ×1