Update list 'Column cannot be null'
Bonjour,
je n'ai pas encore beaucoup d'experience avec Hibernate et je tombe sur un problème que je n'arrive pas a résoudre... je pense que ca doit être une erreur bateau mais pas moyen de me sortir de la !!
J'ai un objet config qui possède une liste de types :
Code:
1 2 3 4 5
| <list name="types" lazy="false" table="type">
<key column="config"/>
<index column="id" />
<one-to-many class="test.objects.Type"/>
</list> |
Je fais une modification basique :
- Je récupère un objet config
- Je renome ses types
- Je sauve l'objet config
- Je tombe sur une erreur :(
Code:
1 2 3 4 5 6 7 8
| ConfigService configService = new ConfigService(session);
Config config = configService.findById("43a23021-2156-4552-a586-2d3719746e1a");
List<Type> types = config.getTypes();
for (Type type : types) {
type.setName("type n°"+i);
}
sessionService.update(config)
tx.commit(); |
Code:
1 2 3 4 5
| Hibernate: update type set name=?, startState=?, endState=?, delay=?, unit=?, config=? where id=?
Hibernate: update type set name=?, startState=?, endState=?, delay=?, unit=?, config=? where id=?
Hibernate: update type set config=null, id=null where config=?14:34:10,400 ERROR [JDBCExceptionReporter:58] Column 'config' cannot be null
14:34:10,416 ERROR [AbstractFlushingEventListener:277] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update |
Je n'ai que 2 elements dans ma liste normalement mais il me fait 3 updates...
Merci d'avance pour votre aide :)