habuma / spring-in-action-5-samples

Home for example code from Spring in Action 5.
Apache License 2.0
1.21k stars 1.04k forks source link

chapter03 tacos-jpa, in Taco entity class, add annotation @NotNull with ingredients #58

Open Sammygracezhu opened 4 years ago

Sammygracezhu commented 4 years ago

When submit without selected any ingredients, no error is displayed with the new page.

I added: @ManyToMany(targetEntity=Ingredient.class) @NotNull(message="You must choose at least 1 ingredient") private List ingredients;

igorye commented 4 years ago

@NotEmpty along with @Size should solve the problem

When submit without selected any ingredients, no error is displayed with the new page.

I added: @manytomany(targetEntity=Ingredient.class) @NotNull(message="You must choose at least 1 ingredient") private List ingredients;

olegkamuz commented 4 years ago

Can be coused by https://github.com/habuma/spring-in-action-5-samples/issues/78