Duplicate entry '3' for key 'PRIMARY' - MySQL
Posted: Wed Oct 14, 2015 4:19 am
by pathfinder2104
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '3' for key 'PRIMARY', This error occurs when I try to save the Product just after starting the demo application. I can see the entry in sequence_generator table for ProductImpl with value 51. Please help and let me know if anymore information is needed.
Re: Duplicate entry '3' for key 'PRIMARY' - MySQL
Posted: Thu Oct 22, 2015 11:23 pm
by phillipuniverse
What version of Broadleaf are you on? If you are on versions prior to 4.0.0-GA, Hibernate's strategy was to use the sequence_generator value as a 'high' and not a low, meaning if the value was "50" then it would start at "1".
The fix is pretty easy, just bump the value in SEQUENCE_GENERATOR up 50 above your highest PRODUCT_ID value in BLC_PRODUCT.