Java – how to use hibernate Properties file instead of hibernate cfg. xml

I'm trying to connect to a DB in a servlet using hibernate I have read that we can use hibernate cfg. XML or hibernate Properties file to configure session For me, it works with XML Now when I try to use attributes instead of XML, it doesn't work

Please help me If I make a mistake, please correct me

Solution

The best way I learned from hibernate is to define hibernate cfg. Mapping in XML file and hibernate Other configurations in properties

Another configuration method is called hibernate cfg. Specify the full configuration in the XML file This file can be used as hibernate An alternative to the properties file, or both, exists to override the properties

Once you have to adjust the hibernate cache, hibernate cfg. XML is also more convenient You can choose to use hibernate Properties or hibernate cfg. xml. Both are equivalent

You can read more at the following links:

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>