10 对象导航查询
定义:
查询一个记录时,也就是查询这个对象,通过这个对象查询他的关联对象
【说白了不就是从我们设置好的集合中获取不就完了吗】
环境搭建:
INSERT INTO `jpa`.`cst_customer` (`cust_name`) VALUES (‘传智博客‘); INSERT INTO `jpa`.`cst_linkman` (`lkm_name`) VALUES (‘张三‘); INSERT INTO `jpa`.`cst_linkman` (`lkm_name`) VALUES (‘李四‘); INSERT INTO `jpa`.`cst_linkman` (`lkm_name`) VALUES (‘王五‘); UPDATE `jpa`.`cst_linkman` SET `lkm_cust_id` = ‘1‘ WHERE `lkm_id` = ‘1‘; UPDATE `jpa`.`cst_linkman` SET `lkm_cust_id` = ‘1‘ WHERE `lkm_id` = ‘2‘; UPDATE `jpa`.`cst_linkman` SET `lkm_cust_id` = ‘1‘ WHERE `lkm_id` = ‘3‘;