Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate "on delete cascade" using Ebean

I am using Ebean and I need to end up getting "on delete cascade" as DDL (data definition language) - which annotation does that? I tried

@OneToMany(cascade=CascadeType.REMOVE)

but that gives "on delete restrict" / doesn't change the default "on delete restrict"?

like image 220
stefan.at.wpf Avatar asked Nov 12 '12 16:11

stefan.at.wpf


1 Answers

Try this

@OneToMany(mappedBy = "parent", cascade = javax.persistence.CascadeType.REMOVE)
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
like image 140
TheWhiteRabbit Avatar answered Oct 13 '22 19:10

TheWhiteRabbit