Hi there!
I have another question to the same topic.
Is there a way to tell hibernate to just ignore null attributes of a Java Object to be persisted?
We set up our database to have many colums as not null, but specified a default value.
When i now instatiate a new object, set some of it's attributes and try to persist it, Hibernate throws an exception like: "cannot insert null in column blah, this column doesn't allow null values".
I'd like hibernate to just not include these null attributes in the insert statement and let the db fill it with default values.
Actually while i think about it, maybe the easiest thing is just to initialize the Java Objects with the same default values as specified in the db.
what do you think?
|