SQL Build Table statement
Description
Well-formed SQL
table statements can be derived directly from PowerDesigner
, and Navicat
other tools to export the SQL
build table statement.
The so-called well-formed, refers to the construction of the table instruction and the table name must be in one row, the field name , type , comments must be on one line, because this tool is implemented with a regular, not a parser, of course, If there is time later, it will be improved into a parser.
Example
-- ------------------------------Table structure for t_activity-- ----------------------------DROP TABLE IF EXISTS' t_activity ';CREATE TABLE' t_activity ' (' ID ')bigint( -) unsigned not NULLauto_increment, ' banner 'varchar( -) not NULLCOMMENT'Event Pictures', ' title 'varchar( -) not NULLCOMMENT'title', ' des 'varchar(1024x768) not NULLCOMMENT'Introduction', ' start_time 'datetime not NULLCOMMENT'Start Time', ' End_time 'datetime not NULLCOMMENT'End Time', ' View_num 'int(Ten) unsigned not NULL DEFAULT '0'COMMENT'Browse Volume', ' Work_num 'int(Ten) unsigned not NULL DEFAULT '0'COMMENT'Amount of contributions', ' Create_time 'datetime not NULLCOMMENT'creation Time',PRIMARY KEY(' id ')) ENGINE=InnoDBDEFAULTCHARSET=UTF8 COMMENT='Activity Table';
Basic Set Bean class package name
Description
java实体类
The full path of the package, just fill in the path, do not need the front of the package
keyword and the end of the semicolon.
Each Java class must have, and therefore required.
Consider that the entity classes are basically under the same package, so only one global can be filled, and not individually set for each class.
Example
Cc.cospace.web.model
Table name Prefix
Description
A good database table naming, there will be a prefix, stating that this is a table, in general this prefix is t_
. java实体类
This prefix is not required at the time of generation, so it can be filtered out.
If you have obsessive-compulsive disorder, like to take the feeling of the prefix, do not fill this.
Example
T_
Bean Supermodel Edition
Description
This tool converts the database table name into the form of a large hump, a small hump, as the Java entity class name.
Here you can specify your own named templates and customize the naming of different styles of entity classes.
There are two variables available for use in a template:
{Lowercamelcase} Bean name Small Hump {CamelCase} bean name Big hump
Example
Assume that the database table name isuser_tag
Do not fill
The resulting bean name is calledUserTag
Fill
Assuming the template is {camelCase}Model
, the resulting bean name is calledUserTagModel
Using wrapper classes
Description
By default, the type of the member variable in the entity class is expressed as a base type, which is checked if you need to use the basic type wrapper class.
It is recommended to use the basic type, the wrapper class has no advantage, but brings many problems.
Example
Uncheck
private int i;
Check
private Integer i;
Ignore fields
Description
Ignore some fields in the table, just fill in the field name, one line at a.
Why should I ignore it? Because some fields are already included in the public parent class, they do not need to be represented in subclasses.
Example
id
create_time
Annotation Set Class Comment template
Description
SQL建表语句
The table comment in is used as java实体类
the class comment in.
Here you can specify your own comment template, the default template is the template in the example.
There are two variables available for use in a template:
{Comment} comment content {date} current date
Example
/**@author jdandian.com* @date {date}* /
Attribute Comment Template
Description
SQL建表语句
The field comment in will be java实体类
commented as a member variable in.
Here you can specify your own comment template, the default template is the template in the example.
There are two variables available for use in a template:
- {Comment} comment content
- {Date} current date
Example
/** * {Comment} */
Inheritance SettingsEnable Parent class
Description
In a well-designed architecture, entity classes typically have a common parent wrapper, tick this option to enable parent class support.
If the entity class does not have a parent class, disregard this.
Example
do not tick Public class A {} tick Public class extends B {}
Parent class name
Description
After you enable the parent class, you must specify the name of the parent class, or the inheritance syntax is incomplete.
Example
BasicModel
Parent Class Package Name
Description
After the parent class is enabled, if the parent class is not under the same package as the child class, you need to specify the package name that contains the parent class separately.
Similarly, just fill in the full write path, do not need the front of the package
keyword and the end of the semicolon.
Example
Cc.cospace.web.model.common
Make things change
Description
The first thing to tell you is that the conversion is done on the server, so don't think about the code [wit].
When you are ready for everything you need, click the Convert button and you will get one zip压缩包
that contains all of the java实体类
.
If your luck is bad enough, you may get a bug with no OVA.
Example
Start the Experience
Online database tables (SQL statements) Generate Java entity class tools
Online database tables (SQL statements) Generate Java Entity class tools-Reference manuals