up1 / assignment-java-boot-camp

8 stars 103 forks source link

รบกวนขอคำแนะนำเรื่อง error ครับผม #24

Open nuttapong opened 2 years ago

nuttapong commented 2 years ago

พอดีติด error นี้อยู่พักใหญ่ละครับผม อยากจะขอคำแนะนำการแก้ไขหน่อยครับ ขอบคุณครับ --- error --- Screenshot_3

--- entity --- Screenshot_1 Screenshot_2

--- initial data in PostConstruct --- Screenshot_4

nuttapong commented 2 years ago

ตอนนี้ผมแก้จนสามารถรันได้ละครับ แต่มีปัญหาใหม่ คือที่ Entity ลูก(ProductAvailable) ผมใส่ FetchType.LAZY แต่พอรันแล้ว มันยังดึงข้อมูลของ Entity แม่(Product) มาด้วยน่ะครับ lazy not work1 lazy not work2 lazy not work3

up1 commented 2 years ago

ก็โยนออกไป response มันก็ execute ดังนั้นก็ return ออกไปถูกแล้วครับ เพราะว่ามันจะทำแบบอัตโนมัติ

เราจะไม่โยน Entity ออกไปยัง response นะครับ ต้องทำการ mapping จาก Entity ไป Response เพื่อให้ return ไปเท่าที่ต้องการครับ

nuttapong commented 2 years ago

ขอบคุณมากครับผม