generate diagrams from hibernate models - java

I have the codebase and SQL creation script of a legacy Spring+Hibernate app, to be retired and migrated. I have limited knowledge of Java (and legacy frameworks), so generating a model diagram may be helpful to understand the old data (and logic).
The SQL script has no foreign keys, but noticed XMLs annotated with models with fields and their relationships for Hibernate.
What's the easiest way to generate model diagrams from these Hibernate XMLs? DjangoGraphviz could be installed to generate models diagrams in a moment. Is there a similar method/tool with Hibernate?

With Hibernate you have Java references between the entities, so any tool visualizing class dependencies might help.
I'm the author of it so I obviously recommend Degraph, but there are many out there. Just google java dependency visualization.

i don't now of any tools to do that in a straight forward way.
you could of course do it on your own. for example use xslt to transform your xml-mapping files to the graphml (xml) format and use a tool like 'yed' (https://www.yworks.com/en/products/yfiles/yed/) to layout and draw a nice diagram.
as a tool to understand legacy code doxygen has served me well because it allows you to browse the package structure, the source, the javadoc and generated UML Diagrams at the same time.
if you need to understand the structures at a database level ... i found
Schemacrawler quite helpful.

Related

Graphical utility for defining a relational database structure for Java

I am using eclipse to develop a java ee web app with Hibernate to provide persistence and an SQL-type interface. Are there any recommended tools for drawing up the relational database model graphically, that can then go on to generate the necessary classes and entities etc for it? Something like the core data tools in Xcode...
There are open source tools, but they are scattershot at best, and the commercial ones can be quite pricey.
I've actually never needed one, except for documentation. Work out the entity relationships in some other fashion (I've used Visio, for instance) and then start setting up your Java code. I've architected systems with dozens of tables with all kinds of relationships, and was never hindered by the fact that I didn't have a GUI tool.
To be honest, some of these tools lock you in, and additionally, you can end up wrestling with their restrictions and quirks as much as with your real work.
One last point: if you need to produce documentation of the DB model, you can use SchemaSpy to generate diagrams of your DB.

Java Code generation using wireframes

I want to generate Java Swing Code by processing MS Visio created wireframes. Is there any tool which can support this?
I know a company called Obeo that markets a tool called Acceleo that is specialized into model to text transformations.
Based upon various Eclipse technologies, it allows one to generate code from DSL/DSL.
They have a site allowing one to use already existing engines, as an example the cinematic model, which is precisely what you're looking for, I guess.
Unfortunatly, to use this tool (and in fact all tools in the generation domain, you'll have to transform your Visio diagram into an XMI one, which is not impossible.

Tools which can draw a project's architecture?

I have one product which is developed in J2EE, the technology that I used as Java, JSF, and for the back end I used AS400 (DB2 database). I am using eclipse IDE. Are there any tools which can help me draw the flow of my product, UML diagrams and the class diagrams.
A UML tool that I like is plantuml It lets you write a text description of a diagram, so you have a lot of flexibility in what you include or exclude. There are plugins for everything from Eclipse to Microsoft Word and even an online servlet. There are tools to reverse engineer classes and you can also embed diagrams into javadoc if you wish.
This is good one. It can draw class, activity,sequence and Usecase diagrams.
http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=AmaterasUML
StarUML is a very good option. It is free and supports most of UML2. This is not being maintained but it is rock solid for what you need.
Use interaction diagrams to document high level flow of your product
Use class/object diagrams to provide static view
Use activity diagrams to document workflow/algorithms
Take a look at Visual Paradigm SDE for Eclipse
Link: http://www.visual-paradigm.com/product/sde/ec/
you can capture requirements, design databases, generate code, implement software and generate reports. SDE supports UML, entity relationship diagram, BPMN and SysML.
Also there are different versions a good version is the Comunity one which is for free..!
You need to create an UML model from your database.
You can use Dali without EclipseUML but database annotations would be lost during the UML reverse engineering if not using Omondo.

How to read XMI?

I need to read UML diagrams that are serialized into XMI. Is there any library that would allow me to conveniently read UML XMI - by conveniently I mean having some methods to iterate over classes/packages/methods/attributest etc. in model.
I tried EMF, but I am unable to find any tutorial that would show how to import XMI containing UML. I have also found NSUML/NSMDF but the link to documentation is broken.
I don't think what you want exists. All tools importing XMI that I know (including my XMI transformation service: http://modeling-languages.com/content/xmi2-tool-exchanging-uml-models-among-case-tools) work by parsing the whole XMI file and creating the corresponding UML model in main memory. Then you can access to the UML elements by querying the model.
To iterate on the XMI model you can easily use XML libraries to select the pieces of the XMI file you are interested in.
Maybe simply have a look at Transforming XMI to HTML. This should help you to get started with XSLT and XMI.
It depends on the version of UML that you are trying to read. The NSUML package that you found only works with UML 1.3. The NetBeans MetaData Repository (MDR) will read handle UML 1.4 and UML 1.5. It can be used as a standalone library (that's what ArgoUML uses), so you don't need NetBeans. For UML 2.x, I think the Eclipse EMF & UML2 libraries are your only choice. EMF is a dependency, but it's really the UML2 stuff that you want. Like with MDR and NetBeans, you don't need Eclipse. ArgoUML uses the Eclipse libraries for its UML 2.x support.
ArgoUML can import XMI to its UML model and generate code for Java, C++, C#, PHP4 and PHP5.
In order to read XMI/UML using EMF, you will need to find, generate or write ECore model for UML. Once you have one of those, you can generate the in-memory classes for manipulating the UML and leverage the other EMF infrastructure.
But a simpler route may be to use the UML2 infrastructure developed by the Eclipse MDT project. (My guess is that it uses EMF under the hood and that there is an ECore model for UML2 in there somewhere.)
What you are looking for is the Java specification for JMI (“Java Metadata Interface”), which implements MOF for describing Metadata and XMI for transporting the Metadata.
Unfortunately I am currently looking for implementations of JMI myself and suns JMI page seems to be a bit outdated.
The open source implementation by netbeans seems to have been dropped for version 6.

Ant task for generating ER diagram from JPA/Hibernate annotated classes

Does anyone know of a tool that can do that?
Linguine maps seems to only work on old hibernate xml files. And the hibernate tool task hbm2hbmxml seems to have a bug so that I can't do the two step process "annotations->hbmxml->diagram"
Best,
Anders
Hmm, I've found this great post on developerworks. There the author seems to generate entity diagrams from a live database. I wonder if I can go "annotated classes -> live db (eg. H2) -> SchemasSpy generated diagram?
And yes, API Viz looks great.
I've blogged my hacky solution with SchemaSpy.
Not quite what you're looking for but you could use API Viz which automatically produces UML like diagrams from class hierarchies and can be augmented with doclet tags.
You'd have to mark up your classes a little, but it's a great tool and worth using wherever you're trying to visualise large or complex projects.

Categories

Resources