-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Existing autoincrement id-values while inserting bulk data
PostPosted: Tue Jul 03, 2007 4:25 am 
Newbie

Joined: Wed Aug 25, 2004 2:23 am
Posts: 4
Location: Ukraine, Kyiv
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.