daughter_wall 2011-06-06 20:11
浏览 279
已采纳

hibernate导出表以后,数据库中为什么没有多对多关系表?

hibernate中实体表对象我建了多对多关联映射,前几天导出表的时候,数据库里有基本表和多对多关系表,现在重新导出表的时候,数据库中只有基本表而没有多对多关系表,怎么回事啊。。。拜托。。。
hibernate明明都发了建多对多关系表的语句,数据库里怎么没有啊???
create table t_car_sp (carId int not null, spId int not null, primary key (carId, spId))
create table t_dd_sp (ddId int not null, spId int not null, primary key (ddId, spId))
create table t_store_sp (storeId int not null, spId int not null, primary key (storeId, spId))

为什么啊。。。

  • 写回答

2条回答 默认 最新

  • xiaoyingSUN 2011-06-06 22:52
    关注

    每个class自己的id
    比如 carId你要先在自己的class里设置了 才能mapping



    不然many-to-many的时候 你的那个 key column ="carId"从哪里来??
    下面的也一样 你都设置成 column = "id"
    mapping时候需要找 "ddId"和"storeId"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示