Hibernate object Annotation

Source: Internet
Author: User

I just had a problem with Brother eight thousand. This is a strange problem that has plagued me for so long. Ah, sorry.

I used the three frameworks to write the complete settings. As a result, when I obtained the foreground number today, I found that one of the values could not be passed.

I started to use the data named cows. Then I changed the database and added some fields. The database name was named mycows.

The problem starts from now on. cows has a piece of data from 1 to 16, which is from 1 to 18 in mycows. However, in any case, the program obtains values from 1 to 16. After testing, if the problem is solved by using the value of hibernate, it will be taken from the cows database. If it is written in jdbc, it is the correct value in mycows.

We used various methods to check the configuration file, check the path, and even restart the database. After a long time, we had to give up.

Finally, I looked at the object class. Because it is an entity class generated by the annotation, eight thousand brother saw the problem.

"Serial" = "t_role", catalog = "cows" TRole Integer roleId;

Catalog = "cows "!!!

Ah, this specifies the database ....

Because myeclipse is used for reverse generation, the database is cows, but now it is changed to mycows, so data in cows is always queried.

I personally think that the design of the framework is a bit problematic. Since the database is specified in the configuration xml of hibernate, different catalog can be used in this entity class, and no error is reported, this problem is really a headache.

The problem has been solved, but a small problem is really confusing. I hope you will not share the same mistakes.

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.