0
如何創建POJO WITH ANNOTATIONS以便hibernate在映射時創建下表?一列是EE
,另一列是ER
。休眠POJO與同一表中的兩個外鍵
CREATE TABLE friends(
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
followee_id INT(11) UNSIGNED NOT NULL,
follower_id INT(11) UNSIGNED NOT NULL,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
PRIMARY KEY(id),
KEY idx_fk_friends_followee_id (followee_id),
KEY idx_fk_friends_follower_id (follower_id),
CONSTRAINT `fk_friends_followee_id` FOREIGN KEY (followee_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `fk_friends_follower_id` FOREIGN KEY (follower_id) REFERENCES user (id) ON DELETE RESTRICT ON UPDATE CASCADE
)ENGINE=MyISAM DEFAULT CHARSET=utf8;