java – 在Hibernate 5中配置数据源,Tomcat 8

前端之家收集整理的这篇文章主要介绍了java – 在Hibernate 5中配置数据源,Tomcat 8前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

需要一些澄清和帮助.特别感谢描述一般概念或描述它们的链接.

所以,在hibernate网站上我读了下一篇

For use inside an application server,you should almost always
configure Hibernate to obtain connections from an application server
javax.sql.Datasource registered in JNDI. You will need to set at least
one of the following properties:

我有一些问题,因为目前我对DataSource,DataDriver,Tomcat和Hibernate的所有内容感到困惑.

>配置数据源并将SessionFactory绑定到JNDI
是同一个过程?
>如果不是,我们使用DataSource以及为什么我们需要将SessionFactory绑定到JNDI(一般情况下)?
>我明白了吗?如果我们在hibernate.cfg.xml文件中配置DataSource,我们不需要在{tomcat} /conf/server.xml或{tomcat} /conf/context.xml中配置它?
>什么是hibernate.jndi.url?它与hibernate.connection.url相同吗?
>什么是hibernate.connection.datasource?在docs中我读到它是“datasource JNDI name”,所以如果我理解正确它可以是任何名字?
>从Hibernate docs我读到设置至少一个属性hibernate.connection.datasource,hibernate.jndi.url,hibernate.jndi.class,hibernate.connection.username,hibernate.connection.password使我的应用程序使用javax.sql .Datasource在JNDI注册.那么下一个conf已经配置为使用DataSource了吗?
>如何检查DataSource的使用和配置是否正常?

我的hibernate.cfg.xml文件

sql">truesql_comments">truesql">trueMysqLDialectsql.Datasource registered in JNDI. You will need to set at least one of the following properties:-->
     原文链接:https://www.f2er.com/spring/431357.html

猜你在找的Spring相关文章