java - Spring Data CrudRepository 类中的这个 S 参数是什么?
问题描述
谁能告诉我 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是什么??我不明白。
解决方案
推荐阅读
- javascript - FullPage.js 可滚动容器 - Wordpress
- javascript - 每 4 个循环生成带有结束标记的每个 html
- c# - WinUI UWP项目中是否有类似WPF-DataTrigger的东西?
- java-ee-6 - JEE 中的 XA 或非 XA
- angular - 如何从角度的模型组件中调用另一个组件函数?
- javascript - 如何使用javascript设置初始下拉值?
- angular - Angular 2+ 你可以添加/删除基于 html 数据属性的 CSS 类吗?
- php - fread() 和 shell_exec() 返回相同的字符串,但是当我比较它们时,它在我的 PHP 代码中不起作用
- flutter - 超类'Bloc
' 没有零参数构造函数 - java - 不会打开从 eclipse Mac OS 导出的可运行 jar