Friday, March 14, 2008

Hibernate Tools Version Field Mapping

Been using Hibernate tools (HibernateTools-3.2.0.GA) to create some domain classes and mappings out of my existing DB, basically doing some reverse engineering. I came across a bug that I think I should point out.

If the tool encounters a field name VERSION in any table it will not generate a property mapping but a version (tag see below).

<version name="version" type="big_decimal">
<column name="VERSION" precision="22" scale="0"/>
</version>

when it should be

<property name="version" type="big_decimal">
<column name="VERSION" precision="22" scale="0"/>
</property>

Guess you'll have to modify the hbm.xml files manually.

Monday, March 10, 2008

Maven 2 External Dependencies

Been playing with Maven for a little while. I ran intro some trouble setting up dependencies that I manually installed on my local repository $USER_HOME\.m2\repository.

Maven Guide to installing 3rd party JARS describes how to do this. It's basically one command

mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging=

Now when I tried to mvn compile It failed and as part of the debug output stated:

[DEBUG] Artifact not found - using stub model: Unable to download the artifact from any repository

This error was due to the fact that the previous command didn't generate the pom file for every external jar that I added. By adding the -DgeneratePom=true solved the issue.

mvn install:install-file -Dfile= -DgroupId=-DartifactId= -Dversion= -Dpackaging= -DgeneratePom=true


Hope this helps.

On a side note, I know I haven't been publishing as regularly as I used to do it. I'm planning on be more religious about this. Lately I been also working with Websphere 6.1, RAD7 and other IBM tools. Now I know this are not open source and the intent of the log is to address open source technology, but since I belive it's going to be useful I'm going to post that anyway. Besides... its a blog not a publication :D