As3 + java + mysql (mybatis) Automatic Data Tool (3)

Source: Internet
Author: User

This section describes the data configuration. This data configuration is mainly used to convert mysql Data from a database to a java object and then to a data class of an as3 object.

The configuration file is in xml format.

<Objects> <object name = "TUserVO" tableName = "v_user" note = "comment" author = "idoublewei"> <field name = "id" type = "integer" restrict = "primary key" value = "0" note = "identifier"/> <field name = "name" type = "string | 32" restrict = "not null" value = "" note = "nickname"/> </object> </objects>

 

Only one root node objects can be configured. Each sub-Node object represents a data class, and each sub-node field of the object represents an attribute of the Data class.

Object:

--- Name indicates the data class name, which must be specified

--- TableName indicates the name of the generated mysql table. If this attribute is not specified, the name is used as the table name.

--- Note data annotation, which can be left unspecified

--- Author data class Creator, which can be left unspecified

Field:

--- Name indicates the property name of the Data class, which must be specified

--- Type indicates the data class property type, which must be specified (case sensitive)

------ String indicates the string, followed by the symbol "|" + number, indicating the string length, for example,-string | 32, followed by the symbol "| text", indicating that the database uses the TEXT type

------ Integer indicates an integer

------ Unsigned indicates a non-negative integer

------ Decimal indicates decimal

------ Bool indicates a Boolean Value

------ Date indicates the date

--- Restrict indicates the database field constraints, which are output as is and can be left unspecified.

--- Value indicates the default value of the Data Type attribute (the default value of the database is null), which can be left unspecified.

------ If the type is bool, the value can only be true or false.

------ If type is date, you can value: new-new object, MS-date millisecond count, followed by the symbol "|" + number, such as-MS | 428, format-date string, followed by the symbol "|" + date format characters, such as-format | 14-04-16 20:15:36 637

--- Note data class attribute annotation, which can be left unspecified

 

Note that if the specified data type is not in the supported data type list, the data type is output as is. For example, if the configuration property is

<field name="attr" type="com.vo.MyClass" value="null"/>

 

The output is

--- As3: var attr: com. vo. MyClass = null;

--- Java: com. vo. MyClass attr = null;

--- Mysql: attr com. vo. MyClass null,

Because the database does not know the com. vo. MyClass type at all, we do not recommend this configuration here. In the next article (only available in as3 and java Data Synchronization), you can configure this configuration.

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.