Hibernate : CascadeType.PERSIST does not work but CascadeType.ALL to save object

前端 未结 1 1155
梦毁少年i
梦毁少年i 2020-12-10 13:25
@Entity
@Table(name = \"Section_INST\")
public class Section {

@javax.persistence.Id
@GeneratedValue(strategy = GenerationType.SEQUENCE,generator = \"Section_ID_GEN         


        
相关标签:
1条回答
  • 2020-12-10 13:40

    For the save() operation to be cascaded, you need to enable CascadeType.SAVE_UPDATE, using the proprietary Hibernate Cascade annotation, since save() is not a standard JPA operation. Or you need to use the persist() method, and not the save() method.

    0 讨论(0)
提交回复
热议问题