PowerDesigner is a very powerful modeling tool software, comparable to Rose, and it is also one of the most famous modeling software today. Rose is a modeling tool that specializes in UML object models, and then developed to database modeling, while PowerDesigner is just the opposite. It started with database modeling and later developed into a comprehensive case tool.
PowerDesigner is mainly divided into 7 types of modeling files:
1. Conceptual Data Model (CDM) p>
Model data and information, using entity-relationship The data is organized in the form of a diagram (ER diagram) to test the validity and rationality of the data design.
2. Logical Data Model (LDM) p>
Newly added models in PowerDesigner 15. The logical model is an extension of the conceptual model, representing the logical sequence between concepts, and is a model belonging to the method level. Specifically, on the one hand, the logical model displays entities, their attributes, and the relationships between entities; on the other hand, inheritance, references in entity relationships, etc. are displayed in entity attributes. The logical model is between the conceptual model and the physical model, and has the characteristics of the physical model. The many-to-many relationship in the conceptual model will be realized in the logical model by increasing the one-to-many relationship of intermediate entities.
The logical model mainly makes the entire conceptual model easier Understand that, while not relying on specific database implementation, the use of logical models can generate physical models for specific database management systems. The logical model is not necessary in the whole step, and the physical model can be generated directly through the conceptual model.
3. Physical Data Model (PDM) p>
Based on a specific DBMS, in the conceptual data model, logical data model Design on the basis of. Generate the database from the physical data model, or reverse engineer the database to obtain the physical data model.
4. Object-oriented model (OOM) p>
Contains all common UML graphics: class diagrams, objects Diagrams, package diagrams, use case diagrams, sequence diagrams, collaboration diagrams, interaction diagrams, activity diagrams, state diagrams, component diagrams, composite structure diagrams, deployment diagrams (configuration diagrams). OOM is essentially a static conceptual model of a software system.
5. Business Process Model (BPM) p>
BPM describes the various internal tasks and internal processes of the business , And how customers influence each other with these tasks and processes. BPM is a conceptual model of business logic and rules from the perspective of business partners. It uses a diagram to describe the interaction between procedures, processes, information, and cooperation agreements.
6. Information flow model (ILM) p>
ILM is a high-level information flow model, mainly used for Data replication between distributed databases.
7. Enterprise Architecture Model (EAM):< /p>
From the business layer, application layer and technical layer A full description of the enterprise’s system architecture. Including: organization chart, business communication diagram, process diagram, city planning diagram, application architecture diagram, service-oriented diagram, technical basic framework diagram.
As the saying goes “Sharp tool”, PowerDesigner is a powerful “artifact”, if you can use it freely, and then have “peerless martial arts”, then you will basically kill the gods and the Buddhas!
Regarding the basic use of the PowerDesigner physical data model, I Let’s not talk nonsense here, give a link, everyone on earth will know after reading: http://www.cnblogs.com/huangcong/archive/2010/06/14/1757957.html
Here are some more advanced usages and techniques I will focus on.
1. Generate sql script
< p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; text-indent:2em"> Database→Generate Database
Select the file path to be output, that is, the file storage path, and modify the file name as needed, click After confirming, the sql script will be generated.
In the Options tab, you can personalize Select and configure sql scripts, such as canceling foreign keys, removing drop statements, etc.
Which tables can be selected in the Selection tab Generate sql script.
In the Preview tab, you can preview the sql to be generated script.
2. Convert all nouns to uppercase
p>
tools→Model Options…→Naming Convention→Code →Uppercase.
3. The table field design window displays the comment Write a comment
Double-click the table to open the properties window of the table → Columns tab → click on the second to last icon in the upper row (Customize Columns and Filter) → check comment
4. When modifying the field Name of the table, the Code does not automatically change.
tools→General Options…→Dialog→Uncheck Name to Code mirroring
5. Conversion between different databases
Database→Change Current DBMS→Select the target database to be converted
6. Import the sql script to generate the corresponding database table model diagram
File→Reverse Engineer→Database…→Modify the module name and select DBMS
Using script files→click the icon below (Add Files) to add sql script files→OK
7. Generate the object model from the physical model, and generate the corresponding get and set methods
tools→Generate Object-Oriented Model…→select language→modify Name and Code→ (Selection tab→Select the table to generate the object model)→OK
Double-click the generated class diagram of a table to open the properties window → select all fields → change all the fields Visibility to private → click the Add… button below → select Get/Set Operations → OK
Then generate the code: Language→Generate Java Code.. .
[Note: The content under the Add… button in different languages is different, such as C# is Property]
6. Generate database documents
Report→Generate Report…→Select Generate RTF→Modify Repor namet→Language select Chinese→Select file Storage location→OK
PowerDesigner also provides documentation Editing function: Report→Reports…→click New Report icon→modify Repor namet→language selection Chinese→Report template selection Full Physical Report
Then you can open the document editing window, but due to space limitations, I won’t explain in detail how Edited, let’s see for yourself.
8. How to create an auto-increment primary key
Double-click the table to open the properties window → check the P primary key check box →Double-click the field set as the primary key (double-click at the head of the row) or click the attribute icon button at the top →Under the opened window (note that different databases are different, sql server is the identity check box) select sequence, if not Click the New button next to it to create a sequence.
9. How to create a view
Click the view button in the toolbar → create a view → Double-click the view to open the properties window, where Usage indicates whether the view is read-only or updatable. If we only create a general view, then select the query only option.
switch to the SQL Query tab, in the text You can set the SQL query statement that defines the view in the box. It is best not to use * when defining the view, but to use the required column names, so that each column can be seen in the Columns of the view properties. Click the Edit with SQL Editor button in the lower right corner to pop up the SQL Editor to write SQL statements. Other sql statement generators can also be used to generate sql statements.
10. How to create an index
Double-click the table to open the properties window → select the Indexes tab → create a new index →Double-click the index to open the properties window
select Columns Tab→click the Add Columns icon button→select the field to be indexed→OK
Do not select Column definition here, as it will conflict with the primary key.
11. How to create a stored procedure
Click the Procedure button in the toolbar → create a stored procedure → double-click Open the properties window of the stored procedure → select the Definition tab. In the drop-down list box, there are two options: Default Procedure and Default Function. The former is the definition process and the latter is the attributive function. The system will create the SQL statement according to the selected type Template → edit stored procedure script.
The above is the main content of the PowerDesigner physical model In fact, this is just a drop in the ocean. Only one model has just been involved, and there are many other models that are worth learning. If we want to be really comprehensive, that blog post will definitely not fit, and it needs to be serialized.
PowerDesigner is really powerful, use it to design UML It’s also very good. If you have time, you should really learn how to use this tool. If possible, I may introduce how to use PowerDesigner to design the object model UML in a future blog post, or maybe it’s really going to be serialized, haha . So look forward to it!
PowerDesigner is a very powerful modeling tool software, comparable to Rose, and is also one of the most famous modeling software today . Rose is a modeling tool that specializes in UML object models, and then developed to database modeling, while PowerDesigner is just the opposite. It started with database modeling and later developed into a comprehensive case tool.
PowerDesigner is mainly divided into 7 types of modeling files:
1. Conceptual Data Model (CDM) p>
Model data and information, using entity-relationship The data is organized in the form of a diagram (ER diagram) to test the validity and rationality of the data design.
2. Logical Data Model (LDM) p>
Newly added models in PowerDesigner 15. The logical model is an extension of the conceptual model, representing the logical sequence between concepts, and is a model belonging to the method level. Specifically, on the one hand, the logical model displays entities, their attributes, and the relationships between entities; on the other hand, inheritance, references in entity relationships, etc. are displayed in entity attributes. The logical model is between the conceptual model and the physical model, and has the characteristics of the physical model. The many-to-many relationship in the conceptual model will be realized in the logical model by increasing the one-to-many relationship of intermediate entities.
The logical model mainly makes the entire conceptual model easier Understand that, while not relying on specific database implementation, the use of logical models can generate physical models for specific database management systems. The logical model is not necessary in the whole step, and the physical model can be generated directly through the conceptual model.
3. Physical Data Model (PDM) p>
Based on a specific DBMS, in the conceptual data model, logical data model Design on the basis of. Generate the database from the physical data model, or reverse engineer the database to obtain the physical data model.
4. Object-oriented model (OOM) p>
Contains all common UML graphics: class diagrams, objects Diagrams, package diagrams, use case diagrams, sequence diagrams, collaboration diagrams, interaction diagrams, activity diagrams, state diagrams, component diagrams, composite structure diagrams, deployment diagrams (configuration diagrams). OOM is essentially a static conceptual model of a software system.
5. Business Process Model (BPM) p>
BPM describes the various internal tasks and internal processes of the business , And how customers influence each other with these tasks and processes. BPM is a conceptual model of business logic and rules from the perspective of business partners. It uses a diagram to describe the interaction between procedures, processes, information, and cooperation agreements.
6. Information flow model (ILM) p>
ILM is a high-level information flow model, mainly used for Data replication between distributed databases.
7. Enterprise Architecture Model (EAM):< /p>
From the business layer, application layer and technical layer A full description of the enterprise’s system architecture. Including: organization chart, business communication diagram, process diagram, city planning diagram, application architecture diagram, service-oriented diagram, technical basic framework diagram.
As the saying goes “Sharp tool”, PowerDesigner is a powerful “artifact”, if you can use it freely, and then have “peerless martial arts”, then you will basically kill the gods and the Buddhas!
Regarding the basic use of the PowerDesigner physical data model, I Let’s not talk nonsense here, give a link, everyone on earth will know after reading: http://www.cnblogs.com/huangcong/archive/2010/06/14/1757957.html
Here are some more advanced usages and techniques I will focus on.
1. Generate sql script
< p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; text-indent:2em"> Database→Generate Database
Select the file path to be output, that is, the file storage path, and modify the file name as needed, click After confirming, the sql script will be generated.
In the Options tab, you can personalize Select and configure sql scripts, such as canceling foreign keys, removing drop statements, etc.
Which tables can be selected in the Selection tab Generate sql script.
In the Preview tab, you can preview the sql to be generated script.
2. Convert all nouns to uppercase
p>
tools→Model Options…→Naming Convention→Code →Uppercase.
3. The table field design window displays the comment Write a comment
Double-click the table to open the properties window of the table → Columns tab → click on the second to last icon in the upper row (Customize Columns and Filter) → check comment
4. When modifying the field Name of the table, the Code does not automatically follow the change
tools→General Options…→Dialog→Uncheck Name to Code mirroring
5. Conversion between different databases
Database→Change Current DBMS→Select the target database to be converted
6. Import sql The script generates the corresponding database table model diagram
File→ Reverse Engineer→Database…→Modify the module name and select DBMS
Using script files→click the icon below (Add Files) to add sql script files→OK
7. Generate the object model from the physical model, and generate the corresponding get and set methods
tools→Generate Object-Oriented Model…→Select language→Modify Name and Code→(Selection tab→Select To generate the table of the object model)→OK
< img alt="" src="/wp-content/uploadshttp:/img.voidcn.com/vcimg/static/loading.png" style="border:none; max-width:100%" d="61289" s ="ac0_7b7" t="gif">
Double-click the generated class diagram of a table to open the properties window → select all fields → change all field Visibility to private → click the Add… button below → select Get/Set Operations → OK
Then generate the code: Language→Generate Java Code…
< p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; text-indent:2em"> < /p>
[Note: The content under the Add… button in different languages is different, such as C# is Property]
6. Generate database documents
Report→Generate Report…→选择Generate RTF→修改Repor namet→语言选择Chinese→选择文件存放位置→确定
PowerDesigner还提供了文档编辑功能:Report→Reports…→点击New Report图标→修改Repor namet→语言选择Chinese→Report template选择Full Physical Report
之后即可打开文档编辑窗口,不过限于篇幅这里就不再详细说明如何编辑了,大家自己看看吧。
8. 如何建立自增主键
双击表打开属性窗口→勾选P主键复选框→双击设置为主键的字段(在行的头部双击)或者单击上方的属性图标按钮→在打开的窗口下方(注意不同数据库不一样,sql server是identity复选框)选择sequence,如果没有则单击旁边的新建按钮创建一个sequence。
9. 如何建立视图
工具栏中单击视图(view)按钮→创建视图→双击视图打开属性窗口,其中Usage是表示视图是只读的还是可更新的。如果我们只创建一般的视图,那么选择query only选项即可。
切换到SQL Query选项卡,在文本框中可以设置定义视图的sql查询语句,在定义视图时最好不要使用*,而应该使用各个需要的列名,这样在视图属性的Columns中才能看到每个列。单击右下角Edit with SQL Editor按钮,即可弹出SQL Editor编辑器,编写SQL语句。也可采用其他sql语句生成器生成sql语句。
10. 如何建立索引
双击表打开属性窗口→选择Indexes选项卡→新建一索引→双击该索引打开属性窗口
选择Columns选项卡→单击Add Columns图标按钮→选择要建立索引的字段→确定
这里Column definition就不要选了,会与主键冲突。
11. 如何建立存储过程
工具栏中单击Procedure按钮→创建存储过程→双击存储过程打开属性窗口→选择Definition选项卡,其中在下拉列表框中,有Default Procedure、Default Function这两个选项,前者是定义过程,后者是定语函数,系统会根据选择的类型创建SQL语句的模板→编辑存储过程脚本。
以上就是PowerDesigner物理模型的最主要内容了,其实这只是沧海一粟罢了,仅仅刚刚涉及到了一个模型,还有其他好多模型值得我们学习,这里要想真的讲全面的话,那一篇博文肯定容不下,需要连载了。
PowerDesigner真的非常强大,用它设计UML同样很牛叉,大家有时间真应该好好学学这个工具怎么使,如果可能,我可能会在今后的博文中介绍下如何用PowerDesigner设计对象模型UML,或者搞不好真的要连载了,呵呵。那么小小期待下吧!