0
I need to leave a default value in this table column, I am mapping the Persistances with Hibernate (summarizing the database is created according to the HQL/JPA I define in Omains.
How do I set a default value for the column ?
@NotEmpty(message="O campo foto não pode ficar em branco !")
@Column(name = "foto_usuario", length = 50, nullable = false)
private String foto;
But if I put it right in the bean like your last example, when the guy doesn’t put anything, he’ll get that one ? and when he setar a photo goes to what he sent, it’s the same thing ? works as default ?
– Matheus Cardozo
Every time you instill an object it will get that property filled, if you are looking for the bank it will have the value that was previously assigned.
– Dilnei Cunha
I think I’ll be clearer now, I need the user to put a url photo in the registration field, if he doesn’t put I want a pattern from our company, which you think is the most appropriate way to do this ?
– Matheus Cardozo
the three way of right, I would leave configured directly on the object because this default image will not change, is one of those phantom images of registration that serves for everyone, but if you have an image of this for male user and another default for female user then you do not escape from having to use @Prepersiste
– Dilnei Cunha