问题标签 [hibernate.cfg.xml]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
2178 浏览

hibernate-envers - 使用 hibernate.cfg.xml 进行 Envers 配置

我正在尝试使用 Envers 审核更新/插入到我的表中。我在数据库中创建了扩展名为 _AUDIT 的审计表。

但是当我实际运行应用程序时,我在审计表中看不到任何条目。我什至没有抛出错误或异常。条目被插入到主表中,但 AUDIT 表没有更新。

这是我的 ENVERS 配置:

休眠.cfg.xml:

我的表如下:

审计表是同一个模式中的 TRANSACTION_AUDIT。

谁能告诉我为什么审计不起作用?

0 投票
1 回答
4701 浏览

hibernate - 休眠 4.0.0。CR4:org.hibernate.internal.util.config.ConfigurationException 与 hibernate.cfg.xml

嗨,我有以下 hibernate.cfg.xml

在我的测试中,我有。

我正在使用休眠 4.0.0.CR4 hsqldb

我得到这个错误。

org.hibernate.internal.util.config.ConfigurationException:无法在资源 hibernate.cfg.xml 中的第 4 行和第 26 列执行解组。消息:cvc-elt.1:找不到元素“休眠配置”的声明。在 org.hibernate.service.internal.JaxbProcessor.unmarshal(JaxbProcessor.java:120) 在 org.hibernate.service.internal.JaxbProcessor.unmarshal(JaxbProcessor.java:69) 在 org.hibernate.service.ServiceRegistryBuilder.configure(ServiceRegistryBuilder .java:162) at org.hibernate.service.ServiceRegistryBuilder.configure(ServiceRegistryBuilder.java:147) 原因:javax.xml.bind.UnmarshalException - 带有链接异常:[org.xml.sax.SAXParseException: cvc-elt. 1:找不到元素“休眠配置”的声明。]

该代码在 hibernate 3.6 GA 中工作,但无法在 hibernate 4 上运行(忽略编译错误)。

怎么了?


抱歉还是不行。我什至尝试使用 MetaDataSources 构建器。

0 投票
0 回答
824 浏览

eclipse - Eclipse Indigo didn't find log4j.xml and hibernate.cfg.xml

I'm using Eclipse indigo (3.7)

I added a hibernate config file and a logger config file, under "src" folder.

The application run but when I try to open the server connection I get:

I have no problems in other prject with the same structure. The applications are RCP ( Rich Client Platform ). What I need to know is how to make sure that Eclipse added correctly the "bin" and "source" folder to the classpath !! If I look the project with the directory perspective I see the files below "bin" folder !!

I think that because of the first problem , hibernate could'nt find theri config file !

Any idea ? Best Reagards

0 投票
9 回答
55724 浏览

java - 休眠-ServiceRegistryBuilder

我只是想学习 Hibernate(版本 4 最终版),但在尝试创建会话工厂时遇到问题。这是一些与问题相关的代码:

hibernate.cfg.xml:


HibernateUtil.java:


现在,似乎问题在于创建 ServiceRegistryBuilder。当代码执行到这一点时,它给了我以下错误:



完整的错误日志:


我该如何解决?我自己似乎无法找到解决方案。

0 投票
1 回答
364 浏览

eclipse - Eclipse + Hibernate + windows xp 赢7

我在 windows xp 上安装了一个 eclipse,一切正常。我的项目是带有gilead hibernate的GWT,数据库是oracle。

当我决定在家工作时,我只是将整个 Eclipse 复制到我的闪存中,并将我的工作区复制到我的 Windows 7。

之后我决定从 oracle Db 转移到 mysql Db,所以我更改了整个 hibernate.cfg.xml 文件为 mysql 做好准备,我删除了 ojdbc 库并添加了 mysql 连接器。

毕竟,当我尝试运行项目时,会显示以下错误:

无法连接到数据库

就像 eclipse 正在从旧的 hibernate.cfg.xml 文件中读取一样。

所以有人知道发生了什么吗???

这是我用于 oracle 连接的 hibernate.cfg.xml 文件:

这是我的 mySql 连接的 hibernate.cfg.xml 文件:

在我这样做之后,这个错误一直在播种:

无法连接到 oracle

但是当我在我的工作电脑上尝试它时,它工作正常。

0 投票
2 回答
1108 浏览

java - 如何在 HIbernate 配置文件 (cfg.xml) 中更改驱动程序类

我正在尝试使用休眠工具在这些应用程序中创建我的第一个休眠应用程序我正在尝试创建 cfg.xml 文件但在这些文件中驱动程序类是“org.gjt.mm.mysql.Driver”它是 MYSQL 5 的默认值但是在进行休眠代码生成配置时,它会抛出驱动程序 ClassNotFound 异常的异常

0 投票
0 回答
845 浏览

hibernate - IReport + Hibernate Datasource 在 cfg.xml 中设置特定的 NamingStrategy

我正在使用 IReport 4.5.1 和 HQL 来查询数据库。所以我定义了一个hibernate.cfg.xml,把它的根文件夹和所需的 *.jar 文件放到 IReport 的类路径中。当我想使用自己的命名策略时,就会出现问题。它只是转换someObject成表名SOME_OBJECT。IReport 无法触发命名策略,因此它搜索表someObject。我试过了

cfg.xml 中的属性名称,但没有运气。有人有想法吗?

谢谢大家。

0 投票
2 回答
17843 浏览

nhibernate - 配置 NHibernate hibernate.cfg.xml 文件以获得更多连接字符串

我的客户要求从 ac# 应用程序从“CURRENT”数据库切换到 TEST 数据库或 DEV 数据库的可能性。一次只能激活一个。在菜单文件中,她选择 DEV 或 TEST 数据库。

如何配置 hibernate.cfg.xml 文件以获得更多连接字符串,例如 app.config。

0 投票
1 回答
1906 浏览

java - 个性化类加载器的休眠加载映射

java jdk1.6.0_17 和 hibernate 有问题。我必须打开一个休眠会话工厂,但映射文件(mapper-test.jar)是由个人类加载器(URLClassLoader)加载的

问题是:

hibernate.cfg.xml:

如果使用构建路径加载映射器测试是成功的,那么映射器测试就可以了。

似乎配置在系统类加载器中而不是在 URLClassLoader 中搜索文件 it/sigeco/infoweb/dao/app/IcFabb.hbm.xml,但是如何将配置与加载器连接?

谢谢

0 投票
1 回答
6398 浏览

java - Hibernate 4 注释配置

我正在尝试仅使用带有注释的 Hibernate 4 和一个hibernate.cfg.xml文件。我已经做了自己的注释,并正在使用反射将其添加到配置中。我能够以这种方式很好地使用 Hibernate 4,但我的配置是使用不推荐的方法构建的。

(不推荐使用的代码:)buildSessionFactory();

甚至 hibernate 4 文档也显示以这种方式构建配置。

如果我尝试使用新方法 ( buildSessionFactory(ServiceRegistry),我不会得到相同的结果,而且似乎有很多不必要的代码来完全按照不推荐使用的方法做。但是,我不想继续使用这种风格,因为无论如何我都不喜欢使用已弃用的代码。

我的问题是:如何以上述方式仅从配置文件正确配置 Hibernate 4?我似乎只是造成错误并面临不必要的困难。