I\'m trying to persist an object to a database. Keep getting \'Column ID cannot accept null value error\'. My object looks like this:
@Entity
public cl
Just in case someone arrives at this thread with the same problem as me. I have been struggling with this for some hours now, and just want to post my solution. It seemed the ID was always set to 0, and that threw an error.
The id property in the model must be of type "Long" or "Integer" and not "long" or "integer" (notice the capitalization). I had put "long", which is a primitive type and cannot be null. Therefore the default value was 0 and Hibernate didn't realize that it was a new entity and tried to save it with ID = 0, something that obviously did not work.
Changing this into the reference type "Long", which can be null, solved it.