2
我有一個用戶模式,我想包含的「朋友」名單,其中:如何定義同一模型的ManyToMany關係?
@Entity
public class User extends Model {
@Id
public long id;
@ManyToMany
public List<User> friends;
...
}
運行這給了我一個錯誤(Database 'default' is in an inconsistent state
),幷包含下表所示的演進文件:
create table user_user (
user_id bigint not null,
user_id bigint not null,
constraint pk_user_user primary key (user_id, user_id)
)
我該如何解決這個問題?同樣對於獎勵積分,我怎樣才能得到我的用戶朋友的人名單?
那麼,這就是答案。你只需要應用進化。朋友列表是用戶對象「朋友」列表。 – Gus
aahh..there有一些時髦與我的配置。這似乎工作! – Martyn