views:

187

answers:

2

Hello,

Could anyone please describe how to use NHibernate Query Analyzer? I downloaded it and trying to build it but it fails, I am not quite sure how to use it.

I am using nHibernate with Sybase and WCF.

Any help is greatly appreciated.

Thanks

+1  A: 

Setup NHibernate Query Analyzer (NHQA) Project

After downloading the tool, run Ayende.NHibernateQueryAnalyzer.exe and then:

File -> New -> Project

Click 'Add File(s)...' button and add the following files:

  1. your NHibernate configuration file (i.e. *.cfg.xml, *.exe.config, or *.web.config file)
  2. your assembly DLL (or DLLs) that contain the NHibernate mapped classes and also have the mapping file(s) as an embedded resource
  3. your mapping files only if they have not been added as embedded resources to the DLLs in # 2

(note: in older versions of NHQA, it was necessary to copy the DLLs including its dependencies to the same directory as the NHibernateQueryAnalyzer.exe but that is no longer the case)

Click 'Build Project' button

If receive errors, then something needs to be fixed in either the configuration file, the mapping file(s), the classes in the DLL(s), or all of them. It is important to note the exception messages to help troubleshoot and identify which of the above is source of the problem.

Run Queries

After successfully building the NHQA project, you can create queries:

File -> New -> Query

Now, type in HQL statements. Entities' names and properties can be dragged and dropped from the tree view on the left to your HQL statements on the right. As you type, it provides on-the-fly checking and validation of your HQL statements in the 'Exceptions' tab and displays the auto generated SQL statements in the 'SQL' tab. A sidebar GUI is also available for dynamically defining named parameters.

Hit F5 to execute the query. If it executes successfully, you can view the results in tabular form in the 'DataBase Results' tab or as objects in the 'Object Graph' tab.

Configure Files

New Mapping files can be created by:

New -> Mapping (hbm.xml)

or existing ones can be edited directly:

Open -> Open Mapping...

Same for Configuration files:

New -> Configuration (cfg.xml)

Open -> Open Configuration...

References

Documentation on setup and usage tutorial for NHibernate Query Analyzer is quite sparse but hopefully the above helps. For more info, check out this demo (a bit out-of-date but still useful.)

Ray Vega
I will try this out soon, thanks!
VoodooChild
A: 

Hi all.

I will use this thread since my issue is similar. What I am trying to accomplish is to do a build with NHibernate 2.1.2.400, but I'm missing the goal.

Could someone point the directions?

When check out of svn project, there are two projects that I can't retrieve - NHibernate and NHibernate.ByteCode.Castle.

I am failing to load last one.

I had retrieve NHibernate project also from svn.

Fig