2013-02-10 36 views
0

我使用Proxool 0.9.1。由于Hibernate 4.x,ProxoolConnectionProvider已被移动到org.hibernate.service.jdbc.connections.internal包(在jar中:$ {hibernate-release-4.x}/lib/optional/proxool/hibernate- Proxool的-4.x.jar)。Hibernate4 Proxool 0.9.1

当我从升级3.X到4.x(配置没有改变),它总是告诉我

Exception: the url can not be null 

...所以我追查Hibernate的源代码,并发现该方法public void configure(Properties props)在ProxoolConnectionProvider中从未被调用过,所以ProxoolConnectionProvider中的所有属性都是null。

任何人都可以帮我解决这个问题吗?

回答

0

出现这种情况是由于通过延长org.hibernate.service.jdbc.connections.internal.ProxoolConnectionProvider贯彻org.hibernate作为Hibernate的4.x版(HHH-7289

可以解决此问题的错误。 service.spi.Configurable接口。例如:

public class ConfigurableProxoolConnectionProvider extends ProxoolConnectionProvider implements Configurable 
    @Override 
    public void configure(final Map configurationValues) { 
     final Map<?,?> configuration = (Map<?,?>) configurationValues; 
     final Properties properties = new Properties(); 
     for (final Map.Entry entry : configuration.entrySet()) { 
      properties.setProperty(
       String.valueOf(entry.getKey()), 
       String.valueOf(entry.getValue())); 
     }  
     super.configure(properties); 
    } 
} 

然后引用延伸类(例如xxx.yyy.ConfigurableProxoolConnectionProvider)在休眠特性下“hibernate.connection.provider_class”。