The object-relational mapper for .NET

HqlAddin on Hbms!

A month ago I released HqlAddin Green Popotito. After talking with my friend Fabio Maulo, he convinced me to add support for hbm files. Well, that’s it, the new release add supports for hbm.xml files and I’ve absolutely dropped the support for “hql” files (sorry but this is not the standard way of writing named queries). So, “Green popotito” is the last version with support for hql files.

In this post I will talk about the features of the HqlAddin V 0.9 – Alpha 3.

Syntax highlighting

HqlAddin brings coloring to your queries:


as you can see here:

  • blue; for keywords
  • dark-red; for strings
  • blue-violet; for parameters

Even inside <![CDATA[ ]]> tags:


Error detection

Using the same parser inside NHibernate 3, HqlAddin can detects syntactical problems:


You can see the problem in three places;

  • The red wave underline
  • The tooltip text
  • and in the error list, you can see the exception of ANTLR, and navigate to the line with double click

This is another example of exception:



In order to get intellisense you need to do a little trick, explained in this link. If you don’t do this trick, the other two features explained above will work. I am not so happy with this code, specially with having to touch your code. I will enhance this on futures version, and maybe I will work to add another mechanism. But for now, I only have this. You can add this piece of code on any, any project, even in your data tests project.

A little explanation of the process; in order to get intellisense working, HqlAddin need access to your nhibernate configuration, so you have to export (with System.ComponentModel) an instance of NHibernate.Cfg.Configuration. It doesn’t care what version of NHibernate you are using. HqlAddin will search your configuration when:

  • You open a solution.
  • You build a solution.

The intellisense working:





This combo comes with french fries

Because you are given me an instance of NHibernate’s Configuration, I know when you fail. So, I call this feature “strongly typed hbm’s”. Because, configuring NHibernate actually means “to compile mappings”

This is the snapshot:


This is not a desired feature just a side effect :) and its out of the scope of the addin.

That’s all, as always said, I am way interested in your opinion.

Posted Mon, 27 September 2010 04:37:00 PM by jfromainello
Filed under: HQL

comments powered by Disqus
© NHibernate Community 2024