简体   繁体   中英

Generic Crud in spring data jpa

I have a lot of tables and almost of them i have just to save or delete them without another query.
So I use spring data jpa like this :

 public interface SecteurAlerteRepository extends 
     JpaRepository<SecteurAlerte, Integer>, QueryDslPredicateExecutor<SecteurAlerte>
     { }

But i have to cretae a lot of interface about 50 ones and it's too much !!

there is not a generic way to use just standard query CRUD in Spring data or in a other way ?

There is no way to do this in Spring Data. The inner mechanics of Spring Data need the type parameters from the interface definition and if there is no interface definition with specific type parameters only the bound of the type parameters ( Object in case of doubt) is available which is not usable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM