Search code examples
springspring-dataspring-data-jdbc

SpEL #{#entityName} alternative in Spring Data JDBC


I am extending a base repository with shared queries across entities but unfortunately spring does not support derived delete queries in spring data jdbc.

I had to write a custom query in all my repositories:

@Modifying
@Query("DELETE FROM table WHERE user=:user AND id=:id")
void deleteByUserAndId(@Param("user") int user, @Param("id") Integer id);

Is there a way to get spring to map the entity name into the query like #{#entityName} found here.

Thank you.


Solution

  • No, there is currently no such feature. I also don't think there exists a feature request for this. Feel free to create a ticket asking for it.