org.komamitsu.spring.data.sqlite.SqliteRepository Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-data-sqlite Show documentation
Show all versions of spring-data-sqlite Show documentation
Spring Data integration with SQLite
The newest version!
package org.komamitsu.spring.data.sqlite;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
* A Spring Data fragment repository interface for SQLite. This interface has a feature that's not
* SQLite specific but useful in some cases. {@link CrudRepository#save(Object)} depends on
* auto-increment id columns and {@link CrudRepository} doesn't expose `insert()` and `update()`
* methods. So, users always need to use SQLite's autoincrement feature on tables. For
* non-autoincrement ID tables, indeed there are some workarounds
* https://spring.io/blog/2021/09/09/spring-data-jdbc-how-to-use-custom-id-generation, but they are
* not straightforward. This class provides `insert()` and `update()` instead of {@link
* CrudRepository}.
*
* @param a model class
* @param an identifier class
*/
@NoRepositoryBean
public interface SqliteRepository
extends PagingAndSortingRepository, CrudRepository {
T insert(T instance);
T update(T instance);
}