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 https://git-scm.com/docs/git-describe

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"/>
	</exec>
</target>

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”

Kerala Travelogue – Alleppey

Prelude

The main attraction of Alleppey is houseboat and we started searching for houseboat from the day we decided we were going to Kerala. We couldn’t finalize any from the ones we found online and finally our uncle who had been to Kerala a few months ago gave us the contact details of guy on whose houseboat they had stayed. After some lengthy discussions and a bit of haggling we finalized on Deluxe Houseboat Plan which would cost us ₹7000. In the deluxe plan the AC would work only during the night time and include lunch, evening snacks, dinner and breakfast. The check-in timing would be 12PM and checkout at 9AM.

Now, Munnar to Alleppey is about 180km and takes almost 6 hours to reach there accounting for a couple of halts in between. We were planning to stay only for one night in Alleppey and that too on the houseboat. So to make it on time for the house boat check-in at 12PM we would have to leave latest by 6 AM and would leave us too tired to enjoy the houseboat. So we decided that we will stay one night in Alleppey then next day go to the houseboat.

Day 1

As planned we post checkout we headed to Munnar Tea Museum and left from there for Alleppy by 12 o’clock. We took one halt for lunch on the way and reached Alleppey by 4 o’clock.

Our booking for Alleppey too were done via Oyo rooms and the hotel was A.J Park. The hotel’s interior were good and the rooms were also good, clean but cramped. Despite being Oyo Premium the room didn’t even have mini refrigerator and toilet paper was missing.

A.J.Park
A.J.Park’s Lobby
A.J.Park
Our Room @ A.J.Park
A.J.Park
Our Room @ A.J.Park
A.J.Park
Our Room @ A.J.Park

In the evening we headed towards Alleppey beach which was 1.8 km from the hotel, so we went there walking. We spent the evening on the beach, saw the beautiful sunset and then came back to hotel restaurant for dinner.

Alleppey beach
Alleppey beach
Old pier
Old piers at Alleppey beach
Sunset at Alleppey beach
Sunset at Alleppey beach

Continue reading “Kerala Travelogue – Alleppey”