- This topic has 6 replies, 2 voices, and was last updated 17 years, 11 months ago by Paul Cahill.
-
AuthorPosts
-
Paul CahillMemberHello,
Background
I am a great fan of UML as it allows us to rise above the forest and see the landscape instead of being surrounded by trees at ground level. Hibernate offers the promise of persisting a domain model directly to an object store using ORM. UML is the most efficient way to develop a domain model (helicopter view) of a green field design. I have been heavily involved in the OO consulting world since the early 90s and have been patiently waiting for an environment suitable for seamless design to enterprise level implementation and MDA is a little too obscure for my liking.My Question
The myEclipse bundle includes a UML drawing tool that is complete enough to allow us to rapidly enter a design then generate POJO objects that are nearly suitable for generating Hibernate classes. Simple attribute, class and inheritance relationships seem to work fine. Problems exist when you need to take this one step further to model cardinality as one to many or many to many.Hibernate metadata attributes exist to instruct the hibernate code generators about cardinality (amongst other things). This metadata could be embedded in the generated java code automatically from the UML diagram as all of the information (with the possible exception being the collection type [Set, Bag, Collection, …]) appears in the relationship arc. Information such as names of tables etc can be left as default.
To enter Hibernate attributes manually is an overhead and does not appear to be included in the reverse cycle when you need to refactor the design (iterative design is a fundamental part of good OO design) hence if you want to employ myEclipse as a serious green field design and implementation environment, it gets messy when you start a new cycle.
Is there a way to modify the code generator to automatically produce Hibernate metadata in the generated POJO java classes (forward and reverse)? This will fill in a vital missing piece of the software development process provided by myEclipse.
Regards to all, and great work myEclipse.
Paul Cahill
Riyad KallaMemberPaul,
Excellent analysis and request. Currently the divide occurs because the tool assumes with UML you are going from “Model -> POJO” and for the Hibernate tool you are going from “DB Model -> Persistence POJOS”, so there needs to be some sort of bridge between UML and Hibernate so they cooperate during that generation stage when creating the POJOs.I think this is more likely as we look at Hibernate 3.2 and later with annotations, but it would be a longer term goal at the moment there are other things that we need to get in place before that can happen.
Paul CahillMemberPaul,
Excellent analysis and request.Thanks, I’d hope to be getting concise after 18 years at this game.
Currently the divide occurs because the tool assumes with UML you are going from “Model -> POJO” and for the Hibernate tool you are going from “DB Model -> Persistence POJOS”, so there needs to be some sort of bridge between UML and Hibernate so they cooperate during that generation stage when creating the POJOs.
What I was thinking was that instead of going from UML -> Hibernate, in the meantime, can we go from UML -> POJO -> Hibernate 3.2. The only thing that seems to be missing is the annotations. Sure we can add them manually but what a shame as you’ve already got them in the model.
When you say UML and Hibernate cooperate, I take it you mean for validation purposes?
I think this is more likely as we look at Hibernate 3.2 and later with annotations, but it would be a longer term goal at the moment there are other things that we need to get in place before that can happen.
Is it possible to replace Hibernate 3.1 with Hibernate 3.2 in the myEclipse bundle?
Only being able to go from the Database to POJOs is not much use for green field work. Hibernate champions their ability to allow developers to walk the object tree which is a natural use of OO models. UML diagrams are the ultimate OO models.
Riyad KallaMemberIs it possible to replace Hibernate 3.1 with Hibernate 3.2 in the myEclipse bundle?
Sure. You can do it at the MyEclipse library level under Window > Prefs > MyEclipse > Project Capabilities > Hibernate, or you can just remove our libraries from your build path and add your own.
Only being able to go from the Database to POJOs is not much use for green field work. Hibernate champions their ability to allow developers to walk the object tree which is a natural use of OO models. UML diagrams are the ultimate OO models.
Well to be fair MyEclipse takes you from DB to POJO/DAOs which let you start coding right away. Optionally you can drop those puppies onto a class diagram to get a further visualization of your project… that’s pretty slick 🙂
Paul CahillMemberIs it possible to replace Hibernate 3.1 with Hibernate 3.2 in the myEclipse bundle?
Sure. You can do it at the MyEclipse library level under Window > Prefs > MyEclipse > Project Capabilities > Hibernate, or you can just remove our libraries from your build path and add your own.
Great, at least I can convert my POJOs to DAOs using attributes.
Only being able to go from the Database to POJOs is not much use for green field work. Hibernate champions their ability to allow developers to walk the object tree which is a natural use of OO models. UML diagrams are the ultimate OO models.
Well to be fair MyEclipse takes you from DB to POJO/DAOs which let you start coding right away. Optionally you can drop those puppies onto a class diagram to get a further visualization of your project… that’s pretty slick 🙂
Yes, you can start adapting relational database object to the world of objects. Trouble is you need to lobotomize (and I mean lobotomize) Inheritance, Polymothism and multiplicity relationships.
Sure, this is what lots of developments are doing (there’s a lot of relational databases out there), however, all you are using hibernate for is a fancy way to access existing databases from Java (lots quicker than JDBC I admit). The trouble is, what if you don’t have an old database to contend with?
One of the things I did in the early 90s was develop a reverse engineering tool for C++ (3.0). Using this experience, I would be prepaired to tackle adapting your UML tool to generate Java code with annotations. Is this possible?
Riyad KallaMemberYes, you can start adapting relational database object to the world of objects. Trouble is you need to lobotomize (and I mean lobotomize) Inheritance, Polymothism and multiplicity relationships.
Very true.
One of the things I did in the early 90s was develop a reverse engineering tool for C++ (3.0). Using this experience, I would be prepaired to tackle adapting your UML tool to generate Java code with annotations. Is this possible?
The code isn’t open source, but we’ve had external developers do work for us from time to time when they’ve really needed a change in and it’s always worked out quite well. Depending on how serious you are about this (hitting deadlines, maintenance, etc.) I could get you in contact with the person who would decide on a contribution like this. Just let me know if that is something you are interested in.
Paul CahillMember@support-rkalla wrote:
One of the things I did in the early 90s was develop a reverse engineering tool for C++ (3.0). Using this experience, I would be prepaired to tackle adapting your UML tool to generate Java code with annotations. Is this possible?
The code isn’t open source, but we’ve had external developers do work for us from time to time when they’ve really needed a change in and it’s always worked out quite well. Depending on how serious you are about this (hitting deadlines, maintenance, etc.) I could get you in contact with the person who would decide on a contribution like this. Just let me know if that is something you are interested in.
I have no other interest than acquiring the capability to model POJOs in UML then using Hibernate automatically generate the DAO persistence tier. If I could automatically generate a Web services layer that exposed the DAO API then this would be very useful for prototyping ahead of developing a set of session objects once the business protocols have been worked out.
If I could sign in blood to keep your code safe, then I would be able to incrementally adapt it so that the hibernate attributes are generated from place holders that need to be added to the ‘annotation end’ properties sheets. In most cases, most of the details required to generate the attributes are implicit in the kinds of relationships and multiplicities etc. For 0 …* cardinalities, I’d consider making the kind of Collection to be employed a property of an ‘annotation end’ rather than the generic model property that’s employed now and BTW does not seem to work. I could use ‘Constraints’ such as ordered etc to modify the kind of set used ala OrderedSet.
I would of course make any changes I make available to myEclipse for inclusion in your product. I take it you use the myEclipse tools to maintain the myEclipse tools so the only thing I’d need is access to your CMS repository.
The advantages to me are that I would be able to investigate issues and fix them on the spot and can make adaptations to achieve the kind of automation I am after. The advantages to myEclipse is that you get access to someone with 27 years of computer engineering experience and with specific CASE modelling domain knowledge gained in the last 18 years for free. Come to think of it, I’ve done two projects in the CASE domain, one was a robotics system that automatically generated interconnecting processes that generated implementations from pure state machine diagrams that modelled the robotics sub-sytems. This was very efficient and very successful.
This is starting to sound like a job application but so what, if its needed to convince “the person who would decide on a contribution like this” then well and good.
The next CASE project I did was work in the UK on a trans-Atlantic submarine cable system for STC Submarine systems. This was a large C++ development. I utilised a C++ parser to generate a language troll database, then projected many kinds of class diagrams including inheritance, association, instantiation etc. This tool was written in C++. I negociated with STC for the rights to this tool then visited IDE (the owners of the underlying CASE tool) in San Francisco on the way back to Australia in mid 1991 (well before anyone else had thought to do it). Tony Wasserman and his team were ecstatic however they were too slow to recognise to importance of reverse engineering.
This was about the time when Booch, Rumbaugh, Jacobson and Anthony Wasserman began fighting over who’s modelling language was best. Most people think Booch won and UML was born however, take a look at Rumbaugh’s OMT. It fairly close to UML and no one could draw Booch clouds. I had lunch with Booch, Rumbaugh and Wasserman in Sydney when I delivered the second of three White Papers at the Object World conference in 1993 (sorry to boast).
I simply want to leverage my work and have a full cycle development environment that allows me to adapt an unclutered domain model over several iterations until it’s right then regenerate the persistence tier end to end. The Hibernate ORM tool lets me do this without getting in the way or forcing me to pick an implemation framework too early and does not impose artifacts of EJBs on you unless you want them and comes with all the smarts of Transactions security etc that you need in a enterprise level implementation.
If we could figure out a way to automate use case diagrams them we’d have the beginnings of our session objects ready to become EJB session object or Web services or what-ever. I put forward that this is what MDA is doing with their Accessors. Use cases are nice clean generic statements of use. Without any thought of implementation.
Anyhow, for those other users of myEclipse that may be following this discussion other than the moderator, if you would like to see these changes please express your views here.
Regards,
Paul Cahill
-
AuthorPosts