Hi,
I have a table named "sgllienmouvement" (that I can't modify) :
Code:
mysql> show columns from sgllienmouvement;
+-----------------------+---------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------------------+------+-----+---------------------+----------------+
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| idsglmouvement | bigint(20) unsigned | NO | MUL | 0 | |
| idsglmouvementautre | bigint(20) unsigned | NO | MUL | 0 | |
| idsidevenementpatient | bigint(20) unsigned | NO | MUL | 0 | |
| dateheuredeb | datetime | NO | | 0000-00-00 00:00:00 | |
| etat | varchar(255) | NO | | | |
| idfhausermaj | bigint(20) unsigned | NO | | 0 | |
| datemaj | datetime | NO | | 0000-00-00 00:00:00 | |
+-----------------------+---------------------+------+-----+---------------------+----------------+
8 rows in set (0.01 sec)
The column idsglmouvement is mapped like that :
Code:
<many-to-one class="domain.model.Sglmouvement"
fetch="join" name="sglmouvement">
<column name="idsglmouvement" not-null="false" />
</many-to-one>
When I update an object Sgllienmouvement, if the attribute sglmouvement is null, the following exception is thrown :
Code:
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/XXX] threw exception [Could not execute JDBC batch update] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'idsglmouvement' cannot be null
I tried to execute "update sgllienmouvement set idsglmouvement = null where id = ?" in MySQL and in spite of the warning "Column 'idsglmouvement' cannot be null", the request is correctly executed and the NULL value of idsglmouvement is replaced by a 0 that is the default value of the column.
How can I solve the problem ?
Thanks,
Florian