2

I am trying to create a rest api which when called for my hotels entity, it has list of menu items which is getting called even though I have set the fetchtype for one to many annotation as lazy. Please take a look at my code in the screenshots, thank you.

hotel entity ss

menu item entity

rest controller endpoint

service method implemntation

result screenshot

even though the endpoint i called in postman ss is different, I get same result when calling the the endpoint in above images.

Also, this is the query which is getting fired when I fetch hotels --->


Hibernate: select menuitems0_.hotel_model_id as hotel_mo1_2_0_, menuitems0_.menu_items_m_id as menu_ite2_2_0_, menuitemli1_.m_id as m_id1_3_1_, menuitemli1_.available as availabl2_3_1_, menuitemli1_.item_name as item_nam3_3_1_, menuitemli1_.item_price as item_pri4_3_1_ from hotels_menu_items menuitems0_ inner join menu_items menuitemli1_ on menuitems0_.menu_items_m_id=menuitemli1_.m_id where menuitems0_.hotel_model_id=?

1 Answers1

0

It's might be due to a proxy call by Jackson.

Please try this solution.

fr3ddie
  • 359
  • 3
  • 16