Getting Started: NHibernate Query Analyzer

time to read 2 min | 392 words

Here is a five minute guides to using NQA:

  • Open the application, there shouldn't be any setup neccecary. Just unzip it anywhere and let it start running.
    NQA saves its settings to a file at "%APPDATA%\NHibernate Query Analyzer\Data.sqlite.db" and this should be completely transperant to the user.
  • Go to Project>Add Files and choose an assembly.
    The assembly must be in NQA BasePath (best thing to do would be to copy it to the same directory as NQA's executable). If the assembly contain "*.hbm.xml" resources then the mapping would be loaded into NHibernate. If the assembly contain a "*.cfg.xml" resource then the setup is done. If the assembly doesn't contain "*.hbm.xml" or "*.cfg.xml" then you will need to add those manually. If your application uses App.config, you can add it directly.
  • When you added all required information then the HQL Query text box should become enable and you should be able to execute HQL Queries.
    An assembly with the classes, a configuration file {either App.config or "*.cfg.xml"}, and the mapping files "*.hbm.xml" - Those can be embedded in the assembly or added seperatedly.
  • Any HQL query is a valid and would result in the following actions being taken:
    • Executing the HQL query and displaying the returned object graph.
    • Executing the resulting SQL and displaying the raw results from the database.
    • If an exception occured, the Error Log tab would be displayed, with it's details.
  • If you want to explore the sample project, you need to add two files, "Ayende.NHibernateQueryAnalyzer.SampleDb.dll" and "Ayende.NHibernateQueryAnalyzer.SampleDb.dll.config" to the project, at this point NQA will allows you to execute queries on the database.
    You can see the mapped classes in the Configuration tab, under Class Mapping