public interface ItemRepository extends JpaRepository<Item, Long> {
@Query(value = "select * from items where type = :#{#type?.name()}", nativeQuery = true)
List<Item> findByType(@Param("type") ItemType type);
}
public enum ItemType { NORMAL, LARGE }; |
public interface ItemRepository extends JpaRepository<Item, Long> {
@Query(value = "select * from items where type = :#{#type?.name()}", nativeQuery = true)
List<Item> findByType(@Param("type") ItemType type);
}
public enum ItemType { NORMAL, LARGE };