JPA cascade persistence with entity ElementCollection keys

后端 未结 2 1723
别那么骄傲
别那么骄傲 2021-01-17 20:28

I have two JPA entities like this:

@Entity
class Foo {
    @Id
    private long id;
    // ...
}

@Entity
class Bar {
    @ElementCollection(targetClass = St         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-17 21:13

    You don't need @ManyToMany annotation here. Operations on ElementCollections are always cascaded.

提交回复
热议问题