于外键关联的单向一对一关联单向多对一关联几乎是一样的。唯一的不同就是单向一对一关联中的外键字段具有唯一性约束

create  table Person(personId bigint not null primary key, addressId bigint not null unique )

create tabke Address(addressId bigint not null primary key)

<class name="Person">

<id  name="id" column="personId">

<generator class="native"/>

</id>

<many-to-one  name="address"

column="addressId"

unique="true"

not-ull="true"

</class>

<class name="Address">

<id name="id" column="addressId">

<generator class="native"/>

</id>

</class>

基于主键关联的单向一对一关联通常使用一个特定的id生成器。(请注意,在这个例子中我们掉换了关联的方向。)

create table Person(personId bigint not null primary key)

create table Address(personId bigint not null primary key)

<class name="Person">

<id  name="id" column="personId">

<generator  class="native"/>

</id>

</class>

<class name="Address">

<id name="id" column="personId">

<generator class="foreign">

<param name="property">person</param>

</generator>

</id>

<one-to-one  name="person" constrained="true"/>

</class>

最新文章

  1. 贪吃蛇python零基础教程_自学python-tkinter项目-贪吃蛇的程序(0基础入门学习)...
  2. Vigen#232;re密码
  3. python性能优化之函数执行时间分析_python性能优化之函数执行时间分析
  4. Spring Security源码解析(三)—— HttpSecurity
  5. 感知算法论文(二)Pelee: A Real-Time Object Detection System on Mobile Devices(2018)译文
  6. vue页面传参(多个参数传值)与接参 - 代码篇
  7. 汇编中bss,data,text,rodata,heap,stack段的作用
  8. 如何修改leaflet的marker图标
  9. RabbitMQ 菜鸟教程
  10. 万能遥控器小制作(五)
  11. 托业考试简述 — 托业考试题型、托业考试结构、托业考试考场时间、托业考试学习策略
  12. MSSQL父子关系表的SQL查询(SQL Query for Parent Child Relationship)
  13. 计算机如何取消自动关机,电脑怎么设置自动关机及取消自动关机
  14. 12、Kanzi插件——创建Kanzi Engine插件的方法
  15. 微信公众号里面使用地图导航
  16. 大觉寺,鹫峰,农家院 游玩
  17. 金融专业术语之——期限错配
  18. 全栈Python自动化测试学习资料【付费资源、看到即赚到,】
  19. 基于H.264的嵌入式无线视频监控系统
  20. Mysql5.7卸载

热门文章

  1. 宝塔如何安装多版本php,安装Lnmp(多PHP版本与宝塔)
  2. 用qrcode生成微信支付二维码
  3. [Matlab]篇----回归分析Matlab命令(regress篇)
  4. oracle 统计同比 环比,oracle求同比,环比函数(LAG与LEAD)的详解
  5. 分子动力学模拟之SETTLE约束算法
  6. 研发管理心得,从技术小白做到CTO(研发总监)的辛酸之路
  7. 虚拟化 oracle rac,数据库虚拟化之战:VM与Oracle RAC
  8. 完美字符子串 单调队列预处理+DP线段树优化
  9. HDU:1998 奇数阶魔方(规律填数)
  10. 2021 年 9 项优秀在线电话会议服务比较(带免费选项)