1. update should simply update an existing instance where saveOrUpdate will save it if it doesn't exist or update it if it does. I do not know why update is executing an insert statement...
2. If I understand the problem correctly, you have a table with a column (which cannot be null) and a mapping file that excludes that column... When hibernate goes to insert data into that table, it will not pass anything in for that unmapped column, so by default your database will insert null. To prevent this from happening, you could define a default in your database. Alternatively, you could map the column to your object and provide a private setter/accessor method with a default value in your object.
|