powerdesigner 反向生成ER 图 (带中文注释)
常见问题:
出现Could not Initialize JavaVM!
这是因为powerdesiger需要用32位jdk,因为我的是 64 位系统,开发调试需要使用 64位jdk ,不希望直接修改 java_home,不想直接修改环境变量,
但是可以在powerdesiger安装目录配置脚本startup-classpath.bat
Set JAVA_HOME=D:jdkjdk832
Set CLASSPATH = D:mysql-connector-java-5.1.46.jar
PdShell16.exe
把脚本拖到 命令行 回车执行脚本
显示注释列
-
进入首选项
在PowerDesigner中,表结构的code,name字段均为英文,不易阅读,若需要将备注中的字段替换到name字段显示,则执行方法:Tools -- Execute Commands -- Edit/Run Script ,则弹出如下图中的对话框:
执行后可以将vbscript保存到本地,下次执行时执行本地脚本即可
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl "the current model
"get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model."
Else
ProcessFolder mdl
End If
"This routine copy name into code for each table, each column and each view
"of the current folder
Private sub ProcessFolder(folder)
Dim Tab "running table
for each Tab in folder.tables
if not tab.isShortcut then
if len(tab.comment) <> 0 then
tab.name = tab.comment
end if
On Error Resume Next
Dim col "running column
for each col in tab.columns
if len(col.comment) <>0 then
col.name =col.comment
end if
On Error Resume Next
next
end if
next
end sub
脚本是通过注释内容来替换的,需要在数据库表结构中写好对应的注释。