Defining types of relationship

Report a typo

You have the following entities in your project:

@Entity
public class Comment {

    @Id
    @Column(name = "comment_id")
    private long id;

    @ManyToOne
    @JoinColumn(name = "topic_id")
    private Topic topic;
}
@Entity
public class Topic {

    @Id
    private long id;

    @OneToMany(mappedBy = "topic")
    private List<Comment> comments = new ArrayList<>();

}

Choose the correct type of relationship between these entities.

Select one option from the list
___

Create a free account to access the full topic