Created
September 25, 2021 17:38
-
-
Save alex-ber/f0076eb50d2291f95c4bdcb7b4067bf7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package jcg.zheng.demo.jpademo.repository; | |
| import java.util.List; | |
| import org.springframework.data.jpa.repository.JpaRepository; | |
| import org.springframework.data.jpa.repository.Query; | |
| import org.springframework.data.repository.query.Param; | |
| import org.springframework.stereotype.Repository; | |
| import org.springframework.transaction.annotation.Transactional; | |
| import jcg.zheng.demo.jpademo.entity.Contact; | |
| import jcg.zheng.demo.jpademo.type.PhoneType; | |
| @Repository | |
| @Transactional | |
| public interface ContactRepository extends JpaRepository<Contact, Long> { | |
| @Query("SELECT con FROM Contact con WHERE con.phoneType=(:pType) AND con.lastName= (:lName)") | |
| List<Contact> findByLastNameAndPhoneType(@Param("pType") PhoneType pType, @Param("lName") String lName); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment