java - 我要导出多张关联的数据库表的数据成xml 然后导入到生产环境的相同表内 主键都为uuid 映射关系在导入的时候怎么处理
大家讲道理
大家讲道理 2017-04-18 09:30:10
0
4
1026

我要导出多张关联的数据库表的数据成xml 然后导入到生产环境的相同表内 主键都为uuid 映射关系在导入的时候怎么处理

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
迷茫

If you are just manipulating data, you should use the data import and export function of the database. If you must use Java, since the primary key is UUID, you should not need to import UUID data, but directly generate UUID data when inserting.

迷茫

If the two sets represent the same structure, then the mapping relationship should be written in the table creation statement! Similar to this:
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));
You generate an xml file to import, and the mapping relationship is the same in both databases.
Even if you use java and just read the xml file, you don’t need to consider the mapping relationship.

小葫芦

http://www.yl1001.com/group_article/5341468242779196.htm

刘奇

Turn off all foreign key constraints before importing, and enable foreign key constraints after importing

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template