DataJPA/src/main/kotlin/com/chantha/jdbc/jpa/repo/CustomerRepo.java
2020-05-16 17:20:48 +07:00

21 lines
711 B
Java

package com.chantha.jdbc.jpa.repo;
import com.chantha.jdbc.jpa.model.Customer;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
public interface CustomerRepo extends CrudRepository<Customer,Long> {
@Query(value = "SELECT *\n" +
" FROM tb_order o\n" +
" INNER JOIN order_detail od\n" +
" ON (o.order_id=od.order_id)\n" +
" INNER JOIN tb_customer c\n" +
" ON (o.cus_id=c.id)\n" +
" INNER JOIN product pro\n" +
" ON (pro.product_id=od.product_id)\n" +
"\n" +
"\t\t",nativeQuery = true)
@Override
Iterable<Customer> findAll();
}