0

Im working with Jsf2: XHTML in the presentation layer, CDI Bean in Business logic and Hibernate in the data layer. I have some inputs in the xhtml file for store an object and submit those data to data base. I don't want to save an empty object in DB and I validated this by putting @NotNull in the attribute in the entity. The problem here is @NotNull is not working and the form still save an empty field in DB.In fact , @NotEmpty is working good.

What is the problem please.

Thank you

majdi
  • 43
  • 1
  • 9
  • Empty input fields which are left blank are received as empty strings and empty strings are not the same as `null`s. It requires some configurations. https://stackoverflow.com/a/7548821/1391249 – Tiny Oct 25 '17 at 10:02
  • Thank you @Tiny. It is done now ! – majdi Oct 25 '17 at 10:09

0 Answers0