I have this int
column:
@Column(length = 4)
private int contract_owner_id;
I don't need to set always value for every table row. I get this exception when I make select query:
Can not set int field org.entity.contracts.contract_owner_id to null value
Is there some way to set numb setups when there is no data into the table column?
Java primitive types (such as int , double , or float ) cannot have null values, which you must consider in choosing your result expression and host expression types.
Unlike for pointers, there is no distinct "nulL" value for integers. Given that, your only choice is to store some extra information indicating whether a meaningful value is stored or not.
In C, a null pointer constant must be an integer literal with the value 0, or the same cast to type "pointer to void"1. An integer with a non-zero value (by itself, or cast to type "pointer to void") is not allowed2. So, 0 , 0L and ((void *)0) are all allowed, but something like ((void *)1234) is not.
The primitive datatype int isn't nullable. You need to use the Wrapper class "Integer" in this case. So just replace the type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With