84669 人學習
152542 人學習
20005 人學習
5487 人學習
7821 人學習
359900 人學習
3350 人學習
180660 人學習
48569 人學習
18603 人學習
40936 人學習
1549 人學習
1183 人學習
32909 人學習
我要导出多张关联的数据库表的数据成xml 然后导入到生产环境的相同表内 主键都为uuid 映射关系在导入的时候怎么处理
光阴似箭催人老,日月如移越少年。
如果只是操作数据的话,那应该使用数据库的数据导入导出功能的呀。如果一定要用java,主键既然是UUID,那应该不用导入UUID的数据,而是直接在insert的时候生成UUID数据才对吧。
如果两套表示相同结构的话,那么映射关系应该是写到建表语句里的呀!类似这种:create table student_teacher(student_id int, teacher_id int, constraint student_teacher_PK primary key(student_id,teacher_id), constraint student_id_FK foreign key(student_id) references student(id), constraint teacher_id_FK foreign key(teacher_id) references teacher(id));你生成xml文件导入,映射关系两个数据库都有的而且相同。即使你是用java,只是读取xml文件,不需要考虑映射关系的吧。
http://www.yl1001.com/group_article/5341468242779196.htm
导之前关掉所有外键约束,导之后再启用外键约束
如果只是操作数据的话,那应该使用数据库的数据导入导出功能的呀。如果一定要用java,主键既然是UUID,那应该不用导入UUID的数据,而是直接在insert的时候生成UUID数据才对吧。
如果两套表示相同结构的话,那么映射关系应该是写到建表语句里的呀!类似这种:
create table student_teacher(student_id int, teacher_id int,
constraint student_teacher_PK primary key(student_id,teacher_id),
constraint student_id_FK foreign key(student_id) references student(id),
constraint teacher_id_FK foreign key(teacher_id) references teacher(id));
你生成xml文件导入,映射关系两个数据库都有的而且相同。
即使你是用java,只是读取xml文件,不需要考虑映射关系的吧。
http://www.yl1001.com/group_article/5341468242779196.htm
导之前关掉所有外键约束,导之后再启用外键约束