Additional queries in JPA

后端 未结 2 428
悲&欢浪女
悲&欢浪女 2021-01-24 05:11

I have two classes InvitedPerson and Flight with a one to one relationship with each other. Here is how they are annotated.

public clas         


        
2条回答
  •  无人共我
    2021-01-24 05:57

    You have not set the association from Flight to InvitedTech lazy. So it loads the InvitedTech associated with the flight.

    Since it can't know from the InvitedTech if there exist a Hotel and a Flight associated with the InvitedTech, it can't decide if these fields should be null or should be proxies. So it's forced to execute additional queries to know if a hotel/flight exists for the InvitedTech.

提交回复
热议问题