code_junkie

hibernate insert batch with postgresql

Nov 10th, 2011
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. @Override
  2. protected void doExecuteBatch(PreparedStatement ps) throws SQLException, HibernateException {
  3. if ( batchSize == 0 ) {
  4. log.debug( "no batched statements to execute" );
  5. }
  6. else {
  7. if ( log.isDebugEnabled() ) {
  8. log.debug( "Executing batch size: " + batchSize );
  9. }
  10.  
  11. try {
  12. // checkRowCounts( ps.executeBatch(), ps );
  13. ps.executeBatch();
  14. }
  15. catch (RuntimeException re) {
  16. log.error( "Exception executing batch: ", re );
  17. throw re;
  18. }
  19. finally {
  20. batchSize = 0;
  21. }
  22.  
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment