Hi there everybody,
i got the following problem in my application using Hibernate 2.1.7 in a Tomcat 5.0 w/ Java 5 and an Oracle 8i DB.
i retrieve an business object (i.e. an Employee) and i change some properties on it. when i click on the save button i want a popup to open asking me wether i really want to apply the changes. Therefore i used to call session.saveOrUpdate( model ) after retrieving and call session.isDirty() on save to open the popup or not.
The problem is when the model is a new instance and the db table has not-null columns. SaveOrUpdate automatically creates an insert statement in the batch process, inserting null values to all columns, as a new employee never has any default values/associations. Obviously this causes an sql error at not-null columns.
i excepted the session only to create statements when a transaction is started, which isn't the case here. The transaction begins right after i accepted the save popup.
Is there many option to change this behaviour in the mapping file?
How do you/other users manage the dirty checking in there application?
TIA,
Lothar
|