hmm at some point something changed in my application and i dont understand what.
i save a user
public void saveUser(User user) throws DuplicateUserException {
try {
getHibernateTemplate().save(user);
} catch (DataIntegrityViolationException e) {
// logger.error(e);
throw new DuplicateUserException(user.getUsername());
}
}
but i never get the DuplicateUserException in the bean that calls it when the users exists in the database.
this is my stack trace
Code:Hibernate: insert into USER (password, firstName, lastName, address, areaCode, email, activated, user_id) values (?, ?, ?, ?, ?, ?, ?, ?) 06:37:25,320 WARN JDBCExceptionReporter:38 - SQL Error: 1062, SQLState: 23000 06:37:25,323 ERROR JDBCExceptionReporter:46 - Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1" 06:37:25,331 WARN JDBCExceptionReporter:38 - SQL Error: 1062, SQLState: 23000 06:37:25,333 ERROR JDBCExceptionReporter:46 - Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1" 06:37:25,340 ERROR JDBCExceptionReporter:38 - Could not execute JDBC batch update java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1" ...... ...... 06:37:25,350 ERROR SessionImpl:2379 - Could not synchronize database state with session net.sf.hibernate.JDBCException: Could not execute JDBC batch update ...... ...... Caused by: java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1" ..... ..... 06:37:25,370 ERROR UserBean:70 - Could not add user org.springframework.dao.DataIntegrityViolationException: Hibernate operation: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1"; nested exception is java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1" java.sql.BatchUpdateException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '1' for key 1"
in my applicationcontext.xml i have
Code:<bean id="jdbcExceptionTranslator" class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator"> <property name="dataSource"> <ref bean="dataSource"/> </property> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate.HibernateTemplate"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> <property name="jdbcExceptionTranslator"> <ref bean="jdbcExceptionTranslator"/> </property> </bean> and i also have a hibernateinterceptor to be able to use lazy loading <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate.HibernateInterceptor"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean>
what could have happend?


Reply With Quote
i also get exceptions when i try and update a object