Answer the question
In order to leave comments, you need to log in
How to follow two way @OneToMany in JPA?
Hello, there are two entities
@Entity
open class Member() {
@ManyToOne(optional = false)
open var group: Group? = null
}
@Entity
open class Group() {
@OneToMany(mappedBy = "group", fetch = FetchType.EAGER)
open var members: MutableList<Member> = ArrayList()
}
//сначала rank.group это oldGroup
rank.group = newGroup
Answer the question
In order to leave comments, you need to log in
If you save the rank (which, as I understand it, is of the Member class), then yes, the members set will change.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question