hibernate一对一映射外键关联.docVIP

  • 3
  • 0
  • 约7.53千字
  • 约 8页
  • 2016-08-01 发布于河南
  • 举报
hibernate一对一映射外键关联

hibernate一对一映射外键关联 分类: hibernate 2006-07-25 13:15 3658人阅读 评论(1) 收藏 举报 外键关联:一个外键和一个主键关联 一﹑确定数据的一对一关联关系 数据脚本 drop database if exists test; create database test; use test; create table company ( ID int auto_increment not null primary key, companyName varchar(20) not null, addressID int not null ); ? create table address ( ID int auto_increment not null primary key, address varchar(20) not null ); ? Address表中的主键ID与company表中的外键addressID构成一对一外键关联关系. 双向关联:可以根据company得到address,也可以根据address得到company,双向关联时需要在company.hbm.xml中配置 many-to-one unique=”true” name=”address” column=”addressID” cascade=

文档评论(0)

1亿VIP精品文档

相关文档