I wanted to be consistent with my first post, so i changed the names of the table and so on. the original error message is:
Code:
Hibernate: update Gruppe set UmfrageID=null, Reihenfolge=null where UmfrageID=?
Hibernate: update userumfrage set UmfrageID=null where UmfrageID=?
WARN - JDBCExceptionReporter - SQL Error: 1048, SQLState: 23000
ERROR - JDBCExceptionReporter - Column 'UmfrageID' cannot be null
ERROR - tractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
The problems is hibernate tries to update the uservorlesung table, and sets the UmfrageID (surveyID) = null, thats prohibited by the DB.
I want to keep the data from the users, so if a user is deleted, the table uservorlesung must not be touched. Otherwise if a survey is deleted, the data in this table is not required and has to be deleted.
Conclusion: Do I have to change my DB, so that null is allowed, or is there a way to spezify my an attribute in the survey mapping file, so that all entries from a specific surfvey will be deleted and not updated?