By Chris on December 13, 2022
We needed our compress files generated from our apps at work and I went the old way using a fileInputStream and a fileoutputStream: private static void compressFileToGzipOldWay(File destinationDir, File fileToCompress) throws IOException { String compressedFilesName = fileToCompress.getName() + “.gz”; File compressedFileDir = new File(destinationDir, compressedFilesName); FileInputStream fis = new FileInputStream(fileToCompress.getName()); FileOutputStream fos = new FileOutputStream(compressedFileDir); […]
Posted in java | Tagged gzip, java |
By Chris on July 1, 2021
Sometimes the deadline is yesterday or sometimes your boss wants the change now. Maybe the clients have an important feature that he thought he could do without dev but realised one day before the big marketing splash what he wanted to do is not working. These changes are easy, no problem. I will do it […]
Posted in db, prog, rant, tips | Tagged rant, reflexion |
By Chris on June 17, 2021
In the previous post, we discuss own we change from using mongorepository to using directly mongodb method to access and modify directly the object in db.In this posts we look at code that was deleting with mongorepository and change it to use directly mongodb method with MongoTemplate. Using MongoTemplate is faster and less likely to […]
Posted in java, mongodb, prog, tips | Tagged java, mongodb, MongoRepository, MongoTemplate |
By Chris on June 10, 2021
We had at work a piece of code that was using mongorepository and updating the arrays of the object on a collection instead of using mongodb method directly.The way it was coded had a big issues with concurrency and we were losing update because of it.The problem we had with the way it was updating […]
Posted in java, mongodb, prog, tips | Tagged java, mongodb, MongoRepository, MongoTemplate |
By Chris on May 19, 2021
This is old news, but having work with big bank and insurance companies they tend to stick with the old version of java and they’re underlying libraries, I’ve finally been expose to new ways of testing exception with junit. I use to test exception by adding an expected right after the @Test annotation.@Test(expected = NullpointerException) […]
Posted in java | Tagged assertJ, java, junit, junit4, junit5, mokito, testing |
By Chris on May 12, 2021
We recently added a feature that allowed direct modification on our content for some client vs using the same path (queues) that the batched content is using. Our user were really happy with it, but after our team implemented the new feature, we started having some LazyInitializationException. exception for that problem org.hibernate.LazyInitializationException: could not initialize […]
Posted in java | Tagged Exception, hibernate, java, LazyInitializationException |
By Chris on March 2, 2021
Once upon a time an engineer with years of experience encounter something so basic he doesn’t understand why he didn’t encounter it sooner. This week we had a strange error in our log stating that should have a null values in a map. After some digging in the service where that log was found, it […]
Posted in java | Tagged java, java.util.Map, maps, null |
By Chris on May 20, 2020
I was having that weird error when I was working with mapstruct, turn out that the default java version for mapstruct is java 6. Since our project was in java 11 I was getting the error “Constructor XXX in enum XXX cannot be applied to given types”. My starting config was : <dependencies> <dependency> <groupId>org.mapstruct</groupId> […]
Posted in error, java | Tagged java, java8, mapstruts, maven |
By Chris on July 24, 2018
I have a list of guild but I don’t want to call that sql for each guild. (check previous post for the structure) This one is a little easier, you just have to use the IN (PARAMETER, OPERAND, KEYWORD) instead of equal (=) and you give your list of guild you want in it. select […]
Posted in db | Tagged List, oracle, sql, where |
By Chris on April 2, 2018
A old process we had was fetching a list from a query for each player one by one, and adding it in a excel file with other data needed on the player. Seeing that process was slow, we decided to turn it into a query. If we take a close look at the model we […]
Posted in db | Tagged batch, listagg, oracle, sql |
Recent Comments