【发布时间】:2018-05-25 03:46:48
【问题描述】:
假设我在hibernate.cfg.xml 文件下面有这个包含数据源配置和包含.hbm.xml 映射的jar 文件的路径:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.251.134:1521:DB</property>
<property name="hibernate.connection.username">rgh</property>
<property name="hibernate.connection.password">rgh</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hibernate.connection.internal_logon">normal</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.hbm2ddl.auto">none</property>
<property name="hibernate.default_schema">rgh</property>
<property name="hibernate.connection.datasource">jndi</property>
<!-- Mapping files -->
<mapping jar="C:\Users\Ghafari\.m2\repository\org\rgh\goodsCirculation\1.0-releases\goods-1.0-releases.jar"></mapping>
<mapping jar="C:\Users\Ghafari\.m2\repository\org\rgh\core\1.0-releases\core-1.0-releases.jar"></mapping>
<mapping jar="C:\Users\Ghafari\.m2\repository\org\rgh\framework\2.1.1-releases\framework-2.1.1-releases.jar"></mapping>
</session-factory>
</hibernate-configuration>
我应该如何配置 intellij idea 以使用休眠控制台并编写 hql 查询?
每个jar文件只包含.hbm.xml文件
更新
我不能把每个映射都像<mapping resource="org/rgh/hibernate/Category.hbm.xml"/> 这样,因为我有超过 1,500 个.hbm.xml 文件。
更新
我最近从 Eclipse 迁移到 Intellij Idea,在 Eclipse hql 编辑器工具中可以正常使用这个 hibernate.cfg.xml 文件,但 Intellij Idea 不起作用。
【问题讨论】:
标签: java hibernate intellij-idea hql