Entity misspelled names, lessons learned, and lessons learned from entity misspelled

Source: Internet
Author: User

Entity misspelled names, lessons learned, and lessons learned from entity misspelled


There was a problem in this project, but it was not a big problem...

 

In V3.0, we used Hibernate to map objects to databases. At that time, someone misspelled an attribute of objects, and the database field was also wrong. in V3.1, we changed to EclipseLink and modified object associations, but still followed the Entity and database in the API at that time.

 

3.1 of developers are familiar with entities, so they do not need to look at how the entities are spelled out. Therefore, they can directly spell out the following statements:

String hql = "select new map (S. id as id ,"

+ "S. name as name ,"

+ "P. professionalNameas professionalName"

+ ") From Student as S left joinS. professional as P"

+ "Where S. isDelete =: isDelete ";

 

The running result is an error.

According to the error prompt, you can know the statement, but no error was found during the check. open the database and check the fields. the professional table has such a field. profesionalName. as a result, the sweat is endless, and one second is missing...

 

If you modify the object and database, errors will occur in the places where this attribute was previously used. If you do not modify the attribute, errors will occur. People who use this attribute will also encounter errors. The more you write, the more errors will be reported.

 

If you ask why 3.0 didn't go wrong at the time, this is because cascade is used and all the properties are clicked. You can leave them empty.

 

 

To sum up, we should be careful when designing the entity and database in the early stage. We can do it together with several people, and we should also have a dedicated person to review it to ensure that each step is correct.


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.