[英]BoneCP and Hibernate
I'm currently in a process to integrate BoneCP into an existing project that has Hibernate, and as I was reading BoneCP's manual, I found this: 我目前正在将BoneCP集成到一个具有Hibernate的现有项目中,当我阅读BoneCP的手册时,我发现了这个:
If you are using this library directly in Hibernate (ie without a DataSource, not recommended) 如果您在Hibernate中直接使用此库(即没有DataSource,不推荐)
and I started wondering why is this? 我开始想知道为什么会这样? Can someone please explain to me why is it bad to use BoneCP directly in Hibernate?
有人可以向我解释为什么在Hibernate中直接使用BoneCP是不好的?
It is a strange recommendation. 这是一个奇怪的建议。
The "not recommended" advice implies not using com.jolbox:bonecp-provider
which only contains one class BoneCPConnectionProvider
. “不推荐”的建议意味着不使用
com.jolbox:bonecp-provider
,它只包含一个类BoneCPConnectionProvider
。
If you want to use BoneCP with Hibernate, you will need the bonecp-provider
because it is a required configuration property in hibernate.cfg.xml
: 如果你想将BoneCP与Hibernate一起使用,你将需要
bonecp-provider
因为它是hibernate.cfg.xml
的必需配置属性:
<property name="connection.provider_class">com.jolbox.bonecp.provider.BoneCPConnectionProvider</property>
(copied from here , but also shown in this SO question ). (从这里复制,但也在这个SO问题中显示 )。
If you do not use the bonecp-provider
, you must use the "default" datasource implementation jcom.jolbox.bonecp.BoneCPDataSource
(shown in this SO question ). 如果不使用
bonecp-provider
,则必须使用“default”数据源实现jcom.jolbox.bonecp.BoneCPDataSource
(在此SO问题中显示 )。 But then you cannot use Hibernate. 但是你不能使用Hibernate。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.