The @Required
annotation on Shop.email
is probably triggering the validation error that is causing your action to return an HTTP 400 (bad request) each time. I think that the field will be null
following your call to bindFromRequest
. Extra logging or debugging can be used to confirm this.
Even if an incoming HTTP POST request to save a shop contains a field with name email, Play doesn't know how to turn the value of this field (a String) into a Member
object. You have to either remove the validation from this field, or annotate it further with a custom data binder that tells Play how to perform the String to Member conversion.
As an extra observation, I would also question the declaration of the following field in your other form class:
@Id
@Email
@OneToMany(cascade={CascadeType.ALL})
@JoinColumn(name="email")
public String email;
The OneToMany
annotation says that an instance of this entity has many email addresses. The type of the field (String) says that an instance of this entity has one email address. These two statements are contradictory.