I'm using spring JpaRepository, and want to provide a generic interface with generic derived SQL queries as follows using el expressions:
public interface BaseRepo <B> extends CrudRepository<B, Long> {
@Query("SELECT b FROM #{#entityName} b)
List<B> findAllB();
}
@Entity
class Booking {} //results in "booking"
This works fine! But what if the desired entity contains an underscore? How could I define the strategy of how the el expressions translate the entity name?
@Entity
@Table(name = "booking_entity")
class BookingEntity {} //results in "bookingentity", missing underscore!
Aucun commentaire:
Enregistrer un commentaire