Reading Hibernate doc, I spotted:
"...We use the UUID generator (only recommended for testing, as integer surrogate keys generated by the database should be prefered..."
It is possible to have Hibernate to perform batch inserts of objects having a native id-generator (an id generated by the database)?
From my observation, it doesn`t work. As soon as you do session.save( object ), the insert statement is sent to the db, not added to a batch just like it would do with a assigned id-generator, for example.
I understand hibernate immediatly send the SQL Statement because it wants to retrieve the generated id and put it in the object however, I don't need that for my use case. All I want to do is regroup a certain amount of objects, insert them in a batch and clear the session.
Our product is cross-db. Alot of users work in cooperation on the network, I absolutely need the database to generate surrogate keys. At the same time, I need batch-inserts, because it minimize round-trips to the db and I can see a huge performance boost.
Thanks.
_________________ - Frank
|