Search code examples
javamysqltomcat5.5hibernate3

Database record reverting after manual change


Problem solved: Thanks guys, see my answer below.

I have a website running in Tomcat 5.5 hooked up to a MySQL5 database using Hibernate3.

One record simply refuses to keep any changes performed on it. If I change the record programmatically, the values revert back to what they were previously.

If I manually modify the record in the database, the values will revert (seemingly once the webapp accesses them).

I have tried stopping Tomcat and changing the values manually then starting Tomcat again. Checking the database, the values remain changed after Tomcat has started the webapp but will revert back again once I load the site.

I have also tried deleting the Tomcat work folder for the webapp and the .ser cache file.

I have also checked the code for the values that are being reverted to and cannot find them.

I have only noticed it on this one particular record.

Edit: I've just had a look at the SQL output from Hibernate using hibernate.show_sql=true. There is an update query logged for the table my row is in. Does anyone know how to resolve the ? for the columns to actual values?


Solution

  • You could temporarily enable the mysql query logging and see exactly what sql statement altered the value. Since you say it changes immediately after the server starts you should be able to figure out the statement pretty quickly.

    http://dev.mysql.com/doc/refman/5.0/en/query-log.html