@Repository
public interface ParticipantRepository extends CrudRepository<Participant,Integer> {
@Query("select e from Participant e WHERE e.event.venue =:venue")
List<Participant> getParticipantsByEventVenue(String venue);
}
As you can see here ^ I have to use e to represent the * symbol. Is that just how JPQL works?
is there an * symbol in JPQL?
Yes, it is particular syntax for JPQL. But if you like to use native SQL query, it is also possible as follows:
@Repository
public interface ParticipantRepository extends
JpaRepository<Participant,Integer> {
@Query("select * from Participant e WHERE
e.event.venue =:venue",nativeQuery = true)
List<Participant> getParticipantsByEventVenue(String venue);}
also it is recommender to use JpaRepository instead of crudRepository.
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.