• Welcome to KonaKart Community Forum. Please login or sign up.
 

Error insert product

Started by mikle48, July 16, 2014, 12:33:18 pm

Previous topic - Next topic

mikle48

Use the example of java_api_examples. Do InsertProduct.
I receive an error.

July 16 15:12:34 INFO (?: DoInsert:?) *** INSERT into products_description took 36 ms: INSERT INTO products_description (language_id, store_id, products_comparison, products_id, products_description, products_name, products_viewed, products_url, language_code) VALUES (1, 'store1', 'Comparison - English', 1, 'Test prod - English', 'Test Prod - E', 0, 'www.testprod.co.uk', en);
com.konakartadmin.app.KKAdminException: Exception Message = (org.apache.torque.TorqueException) - com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1 -1 'for key' PRIMARY '<br/> <br /> Exception Stack Trace = <br/> at com.konakart.db.KKBasePeer.throwTorqueException (Unknown Source) <br/> at com.konakart.db.KKBasePeer.insertOrUpdateRecord (Unknown Source) <br/> at com. konakart.db.KKBasePeer.doInsert (Unknown Source) <br/>
...
com.konakartadmin.bl.AdminProductMgr.insertProductWithOptions (Unknown Source) <br/> at com.konakartadmin.bl.AdminProductMgr.insertProductWithOptions (Unknown Source) <br/> at com.konakartadmin.bl.AdminProductMgr.insertProduct (Unknown Source) <br /> at com.konakartadmin.bl.KKAdmin.insertProduct (Unknown Source) <br/> at com.konakartadmin.apiexamples.InsertProduct.main (InsertProduct.java: 164)
at com.konakartadmin.bl.KKAdminBase.manageThrowable (Unknown Source)
at com.konakartadmin.bl.KKAdmin.insertProduct (Unknown Source)
at com.konakartadmin.apiexamples.InsertProduct.main (InsertProduct.java: 164)

The problem that is transmitted as language_code en, and not 'en'.

How to fix the source code? How to fix this error?

mikle48

query does not work

INSERT INTO products_description (products_id, language_code, products_description, store_id, language_id, products_url, products_name, products_comparison, products_viewed) VALUES (6, en, 'Test prod - English', 'store1', 1, 'www.testprod.co.uk', 'Test Prod - E', 'Comparison - English', 0);
...
com.konakartadmin.app.KKAdminException: Exception Message = (org.apache.torque.TorqueException) - com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '6-1' for key 'PRIMARY'<br/><br/>Exception Stack Trace = <br/>   at com.konakart.db.KKBasePeer.throwTorqueException(Unknown Source)<br/>   at com.konakart.db.KKBasePeer.insertOrUpdateRecord(Unknown Source)<br/>   at com.konakart.db.KKBasePeer.doInsert(Unknown Source)<br/>   at com.konakartadmin.bl.AdminProductMgr.insertProductWithOptions(Unknown Source)<br/>
...
at com.konakartadmin.bl.KKAdminBase.manageThrowable(Unknown Source)
   at com.konakartadmin.bl.KKAdmin.insertProduct(Unknown Source)
   at com.konakartadmin.apiexamples.InsertProduct.main(InsertProduct.java:164)


should be so

INSERT INTO products_description (products_id, language_code, products_description, store_id, language_id, products_url, products_name, products_comparison, products_viewed) VALUES (6, 'en', 'Test prod - English', 'store1', 1, 'www.testprod.co.uk', 'Test Prod - E', 'Comparison - English', 0);

How to fix?

KonaKart v7.2.0.2
Example from java_api_examples

julie

From the stack trace it looks like your problem is a duplicate key.