public void saveAll ( PGConnection connection , Stream < TEntity > entities ) throws SQLException { try ( PgBinaryWriter bw = new PgBinaryWriter ( configuration . getBufferSize ( ) ) ) { // Wrap the CopyOutputStream in our own Writer: bw . open ( new PGCopyOutputStream ( connection , mapping . getCopyCommand ( ) , 1 ) ) ; // Insert Each Column: entities . forEach ( entity -> saveEntitySynchonized ( bw , entity ) ) ; } }
Save stream of entities