i have simple two models and i'm trying to create simple OneToMany between them, as far as i'm newbie to use this library i can't use library documentation, my main model is:
@Table(database = AppDatabase.class)
public class ModelChannelPosts extends BaseModel {
@PrimaryKey
private int id;
@Column
private String channelId;
@Column
private List<ModelVideos> channel_video_containers;
@Column
private String createdAt;
@Column
private String updatedAt;
public ModelChannelPosts() {
}
@OneToMany(methods = {OneToMany.Method.ALL}, variableName = "channel_video_containers")
public List<ModelVideos> getVideos() {
if (channel_video_containers == null || channel_video_containers.isEmpty()) {
channel_video_containers = new Select()
.from(ModelVideos.class)
.where(ModelVideos_Table.channelId.eq(id))
.queryList();
}
return channel_video_containers;
}
...
}
and that has many ModelVideos
, then ModelVideos
belongs to ModelChannelPosts
:
@Table(database = AppDatabase.class)
public class ModelVideos extends BaseModel {
@PrimaryKey
private int id;
@Column
private String fileName;
@Column
private String videoLength;
@Column
private int channelId;
public ModelVideos() {
}
...
}
in ModelChannelPosts_Table
file model.channel_video_containers
is unknown and i get this error:
Error:(168, 48) error: <identifier> expected
how can i implementing OneToMany
for them?( make relation ship between channel_video_containers
on ModelChannelPosts
and channelId
on ModelVideos
?