GIT: Get Tag Details of Current Checkout

About two weeks ago I migrated a project from CVS to git. After migration when we tried to build the project it kept failing.

On debugging, I figured that in build.xml (it’s a legacy project with a complex ANT build script) they were trying to figure out from which tag it has been checked out by reading the Tag file in the .CVS folder.

Since this file wasn’t going to be there in the cloned git repo, I started looking ways to achieve this in git. I finally found a git command which gives the tag details of the current checkout, and it’s:

git describe

This command gives the details about the most recent tag reachable from it. You can read more about it at

To use it in ANT all one has to do is create a an executable git target and pass describe as its argument. Below is how we are getting the details:

<target name="tag-details" >
	<!-- Get the closest tag string using git describe if possible -->
	<echo message="Getting git tag details"/>
	<exec executable="git" outputproperty="project.tag.details" failifexecutionfails="false">
		<arg value="describe"/>

Hibernate: Dynamic Insert

While doing code-review I came across hibernate’s dynamic-insert property and found it really useful. dynamic-insert is a boolean attribute of class element as defined in hibernate-mapping-3.0.dtd. This is an optional attribute of the class element and if not defined explicitly defaults to false.

As the name says, setting this property to true makes insert query generated by hibernate dynamic i.e. it will include only non-null values of DTO in the prepared statement.

Let’s explore this with the help of an example, for which I’m using PostgreSQL 9 and Hibernate 5.1.0.
Continue reading “Hibernate: Dynamic Insert”

Official Windows 8 Keyboard Shortcuts from Microsoft

Windows 8In one of my previous posts I had posted a list of new keyboard shortcuts available in Microsoft Windows 8.

I now have the official list of keyboard shortcuts from Microsoft, which you can download it here [PDF].