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
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:
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">
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”