有人可以从org.springframework.data.repository告诉我CrudRepository接口中的S吗?
我创建了一个名为“ DBBooks”的类,它是我的数据库表“ books”的支持对象。
DBBooks.java
SNIPPET
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="book_index")
private Integer book_index;
public Integer getBook_index(){
return book_index;
}
我知道T是我的DBBooks对象,而ID是我表中的book_index键对象类型:
SNIPPET
@Repository
public interface BookRepository extends CrudRepository<DBBook, Integer> {
}
SNIPPET
@NoRepositoryBean
public interface CrudRepository<T, ID> extends Repository<T, ID> {
/**
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
* entity instance completely.
*
* @param entity must not be {@literal null}.
* @return the saved entity will never be {@literal null}.
*/
<S extends T> S save(S entity);
/**
* Saves all given entities.
*
* @param entities must not be {@literal null}.
* @return the saved entities will never be {@literal null}.
* @throws IllegalArgumentException in case the given entity is {@literal null}.
*/
<S extends T> Iterable<S> saveAll(Iterable<S> entities);
但是S是什么?我不明白。