2. Agenda
Scenario
System Design Process
Design ER Diagram
by JDeveloper
Generate DB
schema diagram via
SchemaSpy
Generate artifacts
by MyEclipse
Refactor artifacts
automatically via
ant
Q&A
22009年1月4日星期日
6. JDeveloper Studio
JDeveloper Studio
It contains all the features of the product - including ADF,
SOA, J2EE, UML, Database, Java, and XML. This
download includes JDK 5.0.5 and is supported on Windows
XP, 2003 and 2000.
I used this tool to do schema design and draw ER diagram.
It will create / update / delete tables, columns and
constraints synchrnously as I edit ER diagram.
62009年1月4日星期日
10. SchemaSpy
SchemaSpy
SchemaSpy is a Java-based tool that analyzes the
metadata of a schema in a database and generates a visual
representation of it in a browser-displayable format.
Download: http://schemaspy.sourceforge.net/
SchemaSpy requires:
1. Java 1.4 or higher
2. Graphviz: http://www.graphviz.org/
I use ant to execute command to generate schema
document.
102009年1月4日星期日
11. SchemaSpy
Regarding its commands, please go to
here to check: http://
schemaspy.sourceforge.net/
I had integrated its commands into ant
script, so I can reuse it easily.
112009年1月4日星期日
16. Generate artifacts by MyEclipse
Artifacts include
Entities
DAOs
persistence.xml
162009年1月4日星期日
17. select tables which you want to do
DTO generation in database explore
view
172009年1月4日星期日
18. decide these artifacts will be
generated into which project and in
which package
check this checkbox to tell MyEclipse to
geneate DTOs, and also update these DTOs
to persistence.xml
click Finish button to get DTOs
generation process done.
182009年1月4日星期日
20. DTOs which generated by
MyEclipse. It just full of
getter and setter method.
202009年1月4日星期日
21. Then we go to Database
Explorer view to generate
DAOs
212009年1月4日星期日
22. decide these artifacts should be
generated to which project and
which package.
check this checkbox to tell MyEclipse
to generate DAOs
Click on the Finish button to
get the DAOs generation
process done.
222009年1月4日星期日
26. Refactor artifacts automatically via ant
Refactor rules for entities
1. implement one more interface: Persistable
2. import one more class: import
ht.fc.entity.essential.Persistable;
3. modify object ID generation rules:
@Id@TableGenerator(name = "IDGEN", table =
"htsequence", pkColumnName = "sequence",
allocationSize=1)
4. eliminate @Basic(optional = false), and its import class
262009年1月4日星期日