1
I have a User class and another Contact class which have a relationship between them. It’s all working correctly the question I need to only be recorded a contact if there is any contact attribute filled, but if the user fills only the mandatory user attributes and discards the contact fill need that in the user table stay with NULL and not generating a contact only with your ID. Relationship mapping.
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "contact_id")
private Contato contato;
When I call the screen display I need the: user.setContact(new Contact()); if it does not present NULL error when saving and do not save. How I do this New it comes back and fills the BD with the contact only ID, and on the screen the user has not filled anything.
– Jeremias Santos