hibernateがマッピング時に以下のテーブルを作成するように、注釈付きのPOJOを作成するにはどうすればよいですか?1つの列はfollowEE
で、もう1つはfollowER
です。
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;