package com.liangjian.dataplatform.member.entity.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * @Author: 黄子奇
 * @Date: 2019/11/26
 */
public interface OnlyReadJpaRepository<T,ID> extends JpaRepository<T,ID>, JpaSpecificationExecutor<T> {

    @Override
    default <S extends T> S save(S s) {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default <S extends T> S saveAndFlush(S s) {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default <S extends T> List<S> saveAll(Iterable<S> iterable) {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default void delete(T t) {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default void deleteAll() {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default void deleteAll(Iterable<? extends T> iterable) {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default void deleteAllInBatch() {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default void deleteById(ID s) {
        throw new RuntimeException("this entity can't invoke save");
    }

    @Override
    default void deleteInBatch(Iterable<T> iterable) {
        throw new RuntimeException("this entity can't invoke save");
    }
}
