Reputation: 86747
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!
Upvotes: 0
Views: 3844
Reputation: 3081
You could use the annotation @Entity(name="booking_entity")
.
Upvotes: 2