1
@Column(name="NU_MAGASIN")
private short nuMagasin;

i create entities from table and this column in my db got null value but the didn;t accept it and i got this message

Can not set short field supplycam.entities.Nomenclature.nuMagasin to null value

Azhar Elhar
  • 21
  • 1
  • 3
  • 3
    The message pretty much says it all - a Java short primitive is not nullable. If you want to have a nullable field representing a short, use the Java's `Short` wrapper. – Smutje Jun 26 '19 at 10:22
  • 1
    @Smutje Please don't answer questions in comments and add your comment as answer. I'm tired of looking at already answered questions. Thank you – Simon Martinelli Jun 26 '19 at 12:02

1 Answers1

3

To have an answer on this question I add the code how it must look like:

@Column(name="NU_MAGASIN")
private Short nuMagasin;

In Java short, int, long, float, double, byte, char, boolean are primitive types and not nullable. But there exists a wrapper type for each of these. Usually starting with a capital letter.

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82