如何测试HQL查询? [英] How to test HQL queries?
问题描述
我正在寻找一种快速(非常快速)的方式来测试对hibernate查询的更改。我有一个巨大的应用程序,其中包含数千个不同的HQL查询(在XML文件中)和100多个映射类,我不想重新部署整个应用程序来测试对查询的一个小改动。
一个好的安装程序会如何让我从重新部署中解脱出来并启用快速查询检查? Intellij IDEA 8.1.3选择的机制被称为'Facet'。要立即测试HQL查询:
- 创建数据源工具 - >数据源,添加数据源,定义驱动程序,用户名和密码开发db
- 如果您没有hibernate.cfg,或者您以不同于xml的方式配置会话工厂:创建引用所有XML映射的hibernate.cfg文件(定义一个会话工厂的名称,以方便处理) 在'Project Structure'中添加Facet到您选择的模块,并将最近定义的数据源分配给新的元素
- 切换到Java EE View
- 打开Hibernate Facets - 节点
- 右键单击Session factory并选择打开HQL控制台 / li>
- 在控制台
中输入HQL查询并完成。
- 右键单击Session factory并选择打开HQL控制台 / li>
对于这个RTFM问题感到抱歉。
I'm searching for a fast (really fast) way to test changes to hibernate queries. I have a huge application with thousands of different HQL queries (in XML files) and 100+ mapped classes and i dont want to redeploy the whole application to just test one tiny change to a query.
How would a good setup look like to free me from redeployment and enable a fast query check?
With Intellij IDEA 8.1.3 the mechnism of choice is called 'Facet'. To instantly test HQL queries:
- create a data source Tools -> Data Source, Add Data Source, define driver, username and password of yor development db
- in case you dont have already a hibernate.cfg or you configure your session factory in a different way than via xml: create a hibernate.cfg file referencing all XML mapping's (define a name for the session factory, just for easier handling)
- in 'Project Structure' add Facet to your module of choice and assign the recently defined data source to the new facet
- switch to Java EE View
- Open Hibernate Facets - Node
- Right click Session factory and choose "Open HQL Console"
- enter HQL query in console ...and your're done.
sorry for this RTFM question.
这篇关于如何测试HQL查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!