i'm inserting bulk data into table 'A' in one transaction, it takes about few minutes. Before commiting there are some users that insert data in table 'A' too. The problem is that autoincrement of primary key is changed and i insert data with existing id values.
So how can i make hibernate lock table or do something to take free autoincrement value?
This is how i insert data:
Code:
Session mysqlSession = HibernateUtil.getMySQLSessionFactory().getCurrentSession();
mysqlSession.beginTransaction();
for (Notice notice : myConvertedNotice)
myNotice.persist(notice);
mysqlSession.getTransaction().commit();
DB: MySQL 4.x
Hibernate version: 3.2.1.ga