放弃吧,Hibernate 4直到4.3.0 Beta1还没有解决Proxool连接池不可用的问题

来源:互联网 发布:activiti java 代码 编辑:程序博客网 时间:2024/05/01 21:19

本文出处:http://blog.csdn.net/chaijunkun/article/details/8811246,转载请注明。由于本人不定期会整理相关博文,会对相应内容作出完善。因此强烈建议在原始出处查看此文。


今天想把项目的连接池换一下,从c3p0换成传说中的proxool。按照网上说的教程各种配置,无奈资料都是比较老的,针对Hibernate 4的很少。我用的又是JPA。配置起来稍微有点区别。无论怎么配置就是提示无法创建sessionFactory,一旦调用数据库查询语句就提示The url cannot be null。或者是:Could not open connection。折腾了一天找到了如下两个网址:


https://forum.hibernate.org/viewtopic.php?f=1&t=1017288&p=2468503#p2468503


https://hibernate.atlassian.net/browse/HHH-7289


这是Hibernate 4中的一个很低级的Bug。

有人解释道:

org.hibernate.service.jdbc.connections.internal.ProxoolConnectionProvider.java (hibernate-proxool-4.1.2.Final.jar) does not implement interface org.hibernate.service.spi.Configurable
so the method configure is never called, this leads to a NPE while building the SessionFactory.


就是Hibernate 4中用到的Proxool连接池提供者忘了实现一个Configurable接口导致了没有办法通过配置来生成连接,最终导致在创建SessionFactory的时候产生了空指向异常。


所以朋友们放弃吧。要么自己解决实现Configurable接口,要么就等官方修复这个bug。这个bug在2012年5月的时候就被提出来了,可惜啊,没人解决。

原创粉丝点击