Database name error problem in hibernate database configuration file

Source: Internet
Author: User

A project was previously deployed in Wuhan and deployed in Nanjing. Because it is in line with others to do, the database is built by others to complete, we are only responsible for the database of several tables of data processing. The previous database name is Projectwh, when the deployment of Nanjing, the beginning is also used by the name of the Projectwh, later the other party re-created a database Projectnj (Projectwh not deleted), We have modified the database name in the URL in the Hibernate configuration file to Projectnj, but the target of the discovery access operation will still be the table in the Projectwh.

Generally want to hibernate in the configuration file should only the URL and database name related AH? How can this problem arise. Finally, the global search PROJECTNJ only found that the original corresponding table in the Hibernate mapping file also indicates which database the table belongs to, that is, Hibernate is not based on the database name in the URL to determine the specific use of which database, When two databases are very similar (user name and password), if the database name in the mapping file is incorrectly written, the program will write the data in the corresponding database table in the mapping file. Since mapping files are generally generated automatically, it is very rare to pay attention to this problem.

In summary, when the table that discovers the program action is inconsistent with the table in the expected database, not only to check the URL configuration, but also to check the mapping file of the corresponding table.

Database name error problem in hibernate database configuration file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.