java.sql.SQLException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • There is an problem in JPetStore application. When a new user attempts to registers itself on: http://localhost:8080/jpetstore/shop/newAccount.do there is not handled the case, when entered user id already exists. For example for User ID: j2ee on submit error is displayed: ------------------------------------------------------------- org.springframework.dao.DataIntegrityViolationException: SqlMapTemplate: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')]; nested exception is java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')] java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')] at com.ibatis.db.sqlmap.MappedStatement.executeUpdate(Unknown Source) at org.springframework.orm.ibatis.SqlMapTemplate$8.doInMappedStatement(SqlMapTemplate.java:218) at org.springframework.orm.ibatis.SqlMapTemplate.execute(SqlMapTemplate.java:111) at org.springframework.orm.ibatis.SqlMapTemplate.executeUpdate(SqlMapTemplate.java:216) at org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao.insertAccount(SqlMapAccountDao.java:24) at org.springframework.samples.jpetstore.domain.logic.PetStoreImpl.insertAccount(PetStoreImpl.java:74) ---------------------------------------------------------- Please note, that it is very common problem on user registration. It would be nice to fix this sample to have nice reference implementation. I like to provide fix, but have no idea, how to make custom errors in onSubmit() method of AccountFormController (it is not obvious how to do this).
    via by Henryk Paluch,
  • There is an problem in JPetStore application. When a new user attempts to registers itself on: http://localhost:8080/jpetstore/shop/newAccount.do there is not handled the case, when entered user id already exists. For example for User ID: j2ee on submit error is displayed: ------------------------------------------------------------- org.springframework.dao.DataIntegrityViolationException: SqlMapTemplate: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')]; nested exception is java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')] java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')] at com.ibatis.db.sqlmap.MappedStatement.executeUpdate(Unknown Source) at org.springframework.orm.ibatis.SqlMapTemplate$8.doInMappedStatement(SqlMapTemplate.java:218) at org.springframework.orm.ibatis.SqlMapTemplate.execute(SqlMapTemplate.java:111) at org.springframework.orm.ibatis.SqlMapTemplate.executeUpdate(SqlMapTemplate.java:216) at org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao.insertAccount(SqlMapAccountDao.java:24) at org.springframework.samples.jpetstore.domain.logic.PetStoreImpl.insertAccount(PetStoreImpl.java:74) ---------------------------------------------------------- Please note, that it is very common problem on user registration. It would be nice to fix this sample to have nice reference implementation. I like to provide fix, but have no idea, how to make custom errors in onSubmit() method of AccountFormController (it is not obvious how to do this).
    via by Henryk Paluch,
    • java.sql.SQLException: Violation of unique index: PK_ACCOUNT in statement [insert into ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY, STATE, ZIP, COUNTRY, PHONE, USERID) values ('asdf', 'asdf', 'asdf', 'OK', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'asdf', 'j2ee')] at com.ibatis.db.sqlmap.MappedStatement.executeUpdate(Unknown Source) at org.springframework.orm.ibatis.SqlMapTemplate$8.doInMappedStatement(SqlMapTemplate.java:218) at org.springframework.orm.ibatis.SqlMapTemplate.execute(SqlMapTemplate.java:111) at org.springframework.orm.ibatis.SqlMapTemplate.executeUpdate(SqlMapTemplate.java:216) at org.springframework.samples.jpetstore.dao.ibatis.SqlMapAccountDao.insertAccount(SqlMapAccountDao.java:24) at org.springframework.samples.jpetstore.domain.logic.PetStoreImpl.insertAccount(PetStoreImpl.java:74)
    No Bugmate found.