I don't use MySQL, but I'm wondering if NOT NULL DEFAULT '' means that it will actually insert the empty string if it gets a NULL. In other words, if you insert with VALUES(NULL) from a mysql client, does it complain the same way? or does it go ahead and insert the empty string?
Maybe MySQL only used the default empty string when you *don't* specify a value?
No, I get an error as well when I try it from the mysql command line. I also thought that "values (null)" should make mySQL inserting the default value. So it seems to be a bug (or a feature) of MySQL. I will try it with the newest release of MySQL, maybe it's really a bug.
But if it's not, is there a better way to code around this except using setxxx statements in the create-method of my entity bean ?
IMHO, I don't think it's a bug...but remember I'm not a MySQL user.
Looks to me like the NOT NULL part is a constraint and the DEFAULT '' part is a trigger-ish thing which says "if i don't get a VALUE for this column, make it the empty string." In MySQL's view, you indeed gave it a value, the value just happened to be NULL.
Although using the callback methods may look weird to you now, that's what they're there for.