batch-processing
No matter what, I can’t batch MySQL INSERT statements in Hibernate
It’s likely your queries are being rewritten but you wouldn’t know if by looking at the Hibernate SQL logs. Hibernate does not rewrite the insert statements – the MySQL driver rewrites them. In other words, Hibernate will send multiple insert statements to the driver, and then the driver will rewrite them. So the Hibernate logs … Read more
Running a background Java program in Tomcat [duplicate]
Use an ExecutorService. There’s a few things you should do though, mark the thread as a daemon thread so it atleast won’t tie up tomcat in error scenarios, and you should stop the executor when your servlet context is destroyed (e.g. when you redeploy or stop your application. To do this, use a ServletContextListener: public … Read more
Script runtime execution time limit
One thing you could do (this of course depends on what you are trying to accomplish) is: Store the necessary information (i.e. like a loop counter) in a spreadsheet or another permanent store(i.e. ScriptProperties). Have your script terminate every five minutes or so. Set up a time driven trigger to run the script every five … Read more
Change EOL on multiple files in one go
The Replace dialog can handle extended characters like EOL. Just change “Search Mode” to “Extended”, and you can work with EOL (\r\n in Windows or \n in Unix), tabs (\t), etc. You can also use the Find in Files tab of the dialog to do the replace across multiple files.
How to implement batch fetching with Fluent NHibernate when working with Oracle?
To give you the answer how to use batching with fluent: 1) on the colleciton HasMany<MyEntity>(x => x.Entities) .BatchSize(100); 2) on a class level public MyEntityMap() { Id(x => x…. … BatchSize(100); This corresponds with the 19.1.5. Using batch fetching
Batching DB commands in Entity Framework 4.0
No, it can’t be done (yes – i weep also). EF does not support batch operations, LINQ-SQL had (has) the same problem. You’ve got a few options: Stored Procedures Classic ADO.NET or EntitySQL Triggers I’ve gone with option 1 and 3 in the past. The problem with all three approaches is you lose the EF … Read more
Java 8 Stream with batch processing
For completeness, here is a Guava solution. Iterators.partition(stream.iterator(), batchSize).forEachRemaining(this::process); In the question the collection is available so a stream isn’t needed and it can be written as, Iterables.partition(data, batchSize).forEach(this::process);
Run all SQL files in a directory
Create a .BAT file with the following command: for %%G in (*.sql) do sqlcmd /S servername /d databaseName -E -i”%%G” pause If you need to provide username and passsword for %%G in (*.sql) do sqlcmd /S servername /d databaseName -U username -P password -i”%%G” Note that the “-E” is not needed when user/password is provided … Read more
Batch update/delete EF5
There are two open source projects allowing this: EntityFramework.Extended and Entity Framework Extensions. You can also check discussion about bulk updates on EF’s codeplex site. Inserting 100k records through EF is in the first place wrong application architecture. You should choose different lightweight technology for data imports. Even EF’s internal operation with such big record … Read more