Hibernate详解(四)---->>关联关系映射(一)
?
- ?


- ?


- ?
Employee.hbm.xml
?
?

- ?
配置文件:hibernate.cfg.xml
?
?

- ?
?
2、单向一对多
???? 举个示例来映射单向一对多关联关系。如:一个账号可以下多个订单。
?
Order.java(多方?? 配置文件比较简单)
?
?

- ?


- ?


- Account.hbm.xml
?
?

配置文件:hibernate.cfg.xml
?
?

- >?? ??<hibernate-configuration>?? ????<session-factory>?? ???????? ??????????<!--?数据库方言设置?-->?? ????????<property?name="hibernate.dialect">?? ????????????org.hibernate.dialect.MySQLInnoDBDialect ??????????</property>?? ???????? ??????????<!--?数据库连接参数设置?-->?? ????????<property?name="hibernate.connection.driver_class">?? ????????????com.mysql.jdbc.Driver ??????????</property>?? ????????<property? ?? ??name="hibernate.connection.url">jdbc:mysql:///hibernate</property>?? ????????<property?name="hibernate.connection.username">root</property>?? ????????<property?name="hibernate.connection.password">123</property>?? ???? ??????????<!--实际操作数据库时是否显示SQL?-->?? ????????<!--? ??????????<property?name="hibernate.show_sql">true</property>?? ????????<property?name="hibernate.format_sql">true</property>?? ????????-->?? ???????? ??????????<!--将数据库schema的DDL导出到数据库?-->?? ????????<property?name="hibernate.hbm2ddl.auto">update</property>?? ??????????<!--?以下定义实体类与数据库表的映像文件?-->?? ????????<mapping?resource="com/zxf/domain/Account.hbm.xml"?/>?? ????????<mapping</st