Created
October 24, 2011 19:59
-
-
Save rkroll/1309978 to your computer and use it in GitHub Desktop.
Phone numbers @OrderColumn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table users_phone_number (users_id int8 not null, phone_numbers_id int8 not null, phone_order int8 not null, primary key (users_id, phone_numbers_id)); | |
alter table users_phone_number add constraint FKUSERPHONEUSER foreign key (users_id) references users; | |
alter table users_phone_number add constraint FKUSERPHONEPHONE foreign key (phone_numbers_id) references phone_number; | |
@OneToMany(cascade = CascadeType.ALL) | |
@OrderColumn(name = "phone_order") | |
public List<PhoneNumber> getPhoneNumbers() { | |
return phoneNumbers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment