CREATE TABLE order (
id int(10) NOT NULL auto_increment,
user_id int(12) NOT NULL,
status int(10) NOT NULL,
order_time bigint(20) NOT NULL,
order_desc varchar(100) default NULL,
total_price double NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE item (
id int(12) NOT NULL auto_increment,
order_id int(10) NOT NULL,
product_id int(12) NOT NULL,
dang_price double NOT NULL,
product_num int(10) NOT NULL default '1',
amount double NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;item表中的order_id是外键,关联order表中的主键id
现在我想插入order表和item表,插item表的时候order_id怎么得来hibernate中怎么写
id int(10) NOT NULL auto_increment,
user_id int(12) NOT NULL,
status int(10) NOT NULL,
order_time bigint(20) NOT NULL,
order_desc varchar(100) default NULL,
total_price double NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE item (
id int(12) NOT NULL auto_increment,
order_id int(10) NOT NULL,
product_id int(12) NOT NULL,
dang_price double NOT NULL,
product_num int(10) NOT NULL default '1',
amount double NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;item表中的order_id是外键,关联order表中的主键id
现在我想插入order表和item表,插item表的时候order_id怎么得来hibernate中怎么写
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货