when encountered Duplicate entry error, hibernate would log that error information before throw it out. it really messed up the log when I have deal it in the application level. Same question was proposed early in 2005 https://forum.hibernate.org/viewtopic.php?p=2258025 And I would quote the words in it to express my opinion
it is not feasible to suppress that log message, precisely because it is at level ERROR.
If I need to insert a million records and I expect that maybe a 1000 of them will fail, I don't want to check their existence first, I want to catch the exception, and I don't want garbage in my logs
it is not an hibernate error if a ConstraintViolationException occurs, Hibernate should let me decide if/how/when to log it, and not to pollute my logs.
|