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

13 lines
499 B
Kotlin

package com.chantha.jdbc.jpa.repo
import com.chantha.jdbc.jpa.model.Product
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.CrudRepository
import org.springframework.stereotype.Repository
@Repository
interface ProductRepo : CrudRepository<Product,Long>{
@Query("SELECT * FROM product INNER JOIN order_detail ON (product.product_id=order_detail.product_id)"
, nativeQuery = true)
override fun findAll(): MutableIterable<Product>
}