zoukankan      html  css  js  c++  java
  • 5 、6

    多对一单向关联:

    在Emp中定义一个Dept属性,而在Dept类中无须定义存放Emp对象的集合属性。

                               

                                      1.准备JavaBean

                                         定义Department 类:

                                         定义Employee类:

                                                   

                                    2.准备持久化类的映射文件

                                     准备Department.hbm.xml文件

                        

                                        准备Employee.hbm.xml文件

                   

                                      3.准备hibernate.cfg.xml

                           

                                           

                                                                 

                                                      4.书写测试类

                                 

                              

                      

                        

                                  2、 一对多双向关联

                 

                                      准备JavaBean

                    

                        

                                   2.准备持久化类的映射文件

                          

                            

                                             3.准备hibernate.cfg.xml    、

                          

                                              4.书写测试类

            

                          

  • 相关阅读:
    Kotlin中Range与异常体系剖析
    @RequestParam与@PathVariable的区别
    thymeleaf:局部变量 th:with
    关于thymeleaf th:replace th:include th:insert 的区别
    MockHttpServletRequestBuilder中content和param的区别
    使用spring的JavaMailSender发送邮件
    Spring的注解@Qualifier小结
    MySql 中 case when then else end 的用法
    @Transient 理解
    Vue生命周期-手动挂载理解
  • 原文地址:https://www.cnblogs.com/ainiaiwo/p/5826940.html
Copyright © 2011-2022 走看看