Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete query ... should honour cascading delete if defined #1447

Closed
rbygrave opened this issue Jul 5, 2018 · 0 comments
Closed

Delete query ... should honour cascading delete if defined #1447

rbygrave opened this issue Jul 5, 2018 · 0 comments
Assignees
Labels
Milestone

Comments

@rbygrave
Copy link
Member

rbygrave commented Jul 5, 2018

Unit cases added by PR #1445

Steps to reproduce

Deleting OtoUser ... should cascade delete to OtoUserOptional due to the cascade ALL on the relationship.

The cascade should happen with both delete a bean and delete by query.

@Entity
@Table(name = "oto_user_model")
public class OtoUser extends BaseModel {

  String name;
  
  @OneToOne(optional = true, cascade = CascadeType.ALL)
  OtoUserOptional userOptional;
OtoUser someUser = new OtoUser("someUser");
OtoUserOptional userPref = new OtoUserOptional(...);
...

Ebean.find(OtoUser.class)
  .where() ...
  .delete();

// should delete the associated OtoUserOptional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant