How to use hibernate.properties file instead of hibernate.cfg.xml

后端 未结 4 1588
清酒与你
清酒与你 2021-02-13 00:36

I am trying to connect to DB in a servlet using Hibernate.I have read that we can use either hibernate.cfg.xml or hibernate.properties file for configuration of session.For me i

4条回答
  •  忘了有多久
    2021-02-13 01:03

    If you are using a database from a servlet then you should define a DataSource in your server and point one hibernate property at that instead of defining everything via all the other hibernate properties you're probably using now.

    This has the benefit of permitting you to define connection pooling and other connection related parameters independently of your application.

    For example, your production environment is likely to have a different database password than your test and development environments.

提交回复
热议问题