Answer the question
In order to leave comments, you need to log in
Spring+Hibernate+SQL. How to properly handle Unique index or primary key violation exception?
Good afternoon.
The application is written using Spring-4.3.0.RELEASE + Hibernate-4.3.11.Final.
I write to the database (H2DataBase) using Hibernate thousands of rows at a time. The primary key is composite.
@Override
@Transactional
public void saveOrUpdate(GeneralStats generalStats) {
Session session = sessionFactory.getCurrentSession();
session.saveOrUpdate(generalStats);//исключение получаю здесь
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question