Java EE entity design, list<object> type storage method

Source: Internet
Author: User

1. Some skills in design class. A very similar thing, you can also get two of the entity. Because in many cases, the design of the database is very different from the interface used in the face.

In this case, you can design different entity for the two parties, and then assign values to each other and call each other separately. Will make the design idea become more clear.

2, for the list "Object" type. A database can only be a string (a string in which the data must be converted by a JSON object)

There is no need for a string attribute in the entity, only a list of "Object" can be. However, you need to manually add a method for the set string, so that Java reflection automatically calls the method, generating the corresponding string.

such as type list<object>. Set method Setobjectstr, which implements the action of the object to JSON string.

When the data is in storage, the deposit variable is named OBJECTSTR, so the reflector will call the method automatically.

Fantastic!

The specific code is empty add!

Java EE entity design, list<object> type storage method

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.