Thursday, September 01, 2016

How could I be so stupid using hibernate criteria with timestamp?

I needed to make a query to find all records valid today for columns with effectiveFrom and effectiveTo range
I spent a couple of hours trying to understand why


was giving no results.

After many trials and attempts with other criteria tricks, I remembered that hibernate is not comparting if  currentDate.getTime is greater than effectiveFrom, but if effectiveFrom is greater than currentDate.getTime
So correct sintax for it was the exact opposite


This one worked as it should 

Thursday, June 23, 2016

Java ALWAYS passes by value (and it is ALWAYS an interesting discussion)

Always good as a refresher.

So, when calling a method
  • For primitive arguments (intlong, etc.), the pass by value is the actual value of the primitive (for example, 3).
  • For objects, the pass by value is the value of the reference to the object.

Tuesday, June 07, 2016

Back to basics

I stumbled upon this one, as a rookie :)

whohaaa, it hurts :)

Wednesday, May 25, 2016

How I ran Gradle with cntlm

I was behind a corporate firewall and had to run gradlew (gradle) from Cygwin. The system was running a cntlm authentication proxy.

I ran the following command

export http_proxy=
export https_proxy=$http_proxy

Then I ran

./gradlew -Dhttps.proxyHost= -Dhttps.proxyPort=3128 -Dhttp.proxyHost= -Dhttp.proxyPort=3128

I hope it helps 

Monday, May 23, 2016

Did you know?

Did you know hat  pressing CTRL + directional arrows allows you to browse a text document by skimming entire words?

This discovery is going to change my life!

Tuesday, April 05, 2016

UNION makes ALL the strength

Following the advice from a very expert consultant, I changed my views from an UNION between two select from the same table to UNION ALL and the performance improvements were simply amazing. Before doing so, I had verified that the query were returning different results with the INTERSECT command before doing so.

The difference is that UNION verifies that records are unique, while UNION ALL doesn't. The performance gain is very remarkable 

Monday, March 14, 2016

What TNS stands for in Oracle?

I just discovered that TNS names in Oracle stand for "Transparent Network Substrate".
I feel so happy that I need to share this "secret" with the rest of the universe.