Use SQL script to generate entity class properties for a table field VO

Source: Internet
Author: User

Data modeling after the creation of the corresponding database, in the development of programming often encounter a very troublesome thing, that is to write the table as the corresponding entity class, for the developer of a field of a field of the comparison, copy, paste ... This is a very crazy thing, and now specifically the corresponding script, has been tested in Oracle. The script is as follows:

Select 'Private' ||DECODE (T.data_type,'VARCHAR2',              'String',              'CHAR',              'String',              'DATE',              'Date',              ' Number',              'int',              'LONG',              'Long',              'FLOAT',              'Float')|| Lower(T.column_name)||'; //'||c.comments fromUser_tab_cols t,user_col_comments CwhereT.table_name='TABLENAME'  andC.table_name=T.table_name andC.column_name=T.column_nameORDER  byt.column_id;

Where TABLENAME is the corresponding table name. The effect is as shown in figure:

Next, the full column selects replication, then pastes it in the corresponding entity class, and then uses the Quick Generate Code tool in the development platform. An entity class seconds seconds to fix!!!

Use SQL script to generate entity class properties for a table field VO

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.