Closed petchy closed 2 years ago
มีใน Spring Data JPA หรือจะใช้ Spring Data JDBC ได้ครับ
หลัก ๆ คือ เรื่องของ relationship ใน Entity class ครับ
@OneToOne
@OneToMany
@ManyToOne
ยกตัวอย่างเช่น
@Entity
class Product {
//...
@OneToMany(mappedBy="cart")
private List<MyImage> thumbsnail_images;
//...
}
@Entity
class MyImage {}
ขอบคุณครับ
ผมเก็บข้อมูล product กับ thumbsnail_images แยกกัน ผมต้องการเขียน join 2 table แล้วได้ response แบบนี้
ขอตัวอย่างโค้ดหน่อยครับ ลองทำตามตัวอย่างที่หามาแต่ไม่ได้ครับ