source: src/main/java/project/educatum/repository/PaymentRepository.java

Last change on this file was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 813 bytes
Line 
1package project.educatum.repository;
2
3import org.springframework.data.jpa.repository.JpaRepository;
4import org.springframework.data.jpa.repository.Modifying;
5import org.springframework.data.jpa.repository.Query;
6import org.springframework.stereotype.Repository;
7import project.educatum.model.Class;
8import project.educatum.model.Payment;
9
10import javax.transaction.Transactional;
11import java.util.List;
12
13@Repository
14public interface PaymentRepository extends JpaRepository<Payment, Integer> {
15
16 @Query(value = "select * from project.plakjanja p where p.id_nastavnik = :idTeacher", nativeQuery = true)
17 List<Payment> findAllByIdTeacher(Integer idTeacher);
18
19 @Transactional
20 @Modifying
21 @Query("UPDATE Payment p SET p.amount=:price WHERE p.id=:id")
22 void updatePrice(Integer price, Integer id);
23
24}
Note: See TracBrowser for help on using the repository browser.