Im working on a jsf + hibernate project, I have a bean which should be validate by hibernate before saving into database, This Bean has 5 fields which should be all validate by @NotNull. My problem is : I have 2 interfaces : the first one I need to fill those 5 fields in my first interface : the result => the save is done with no problem because 5 fields are not null in this case , But in my second interface I have only 3 fields to fill => result : the save is not working because the rest of 2 fields are null in this case and are not filled = In second interface.
Find here my bean .
@Entity
@Table(name = "MyBean")
public class MyBean implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@NotNull
@Size(min = 1, max = 15)
@Column(name = "SN")
private String serialNumber;
@NotNull
@Column(name = "MANUFACTURER")
private String manufacturer;
@NotNull
@Column(name = "TYPE")
private String type;
@NotNull
@Column(name = "MINIMUM_STOCK")
private Integer minimumStock;
@NotNull
@Column(name = "MAXIMUM_STOCK")
private Integer maximumStock;
// getters + setters
Any proposition or idea from your part . Thank you in advance