Book a Demo

Author Topic: UML Profile for JPA ?  (Read 8876 times)

SebastienRoy

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
UML Profile for JPA ?
« on: October 22, 2008, 12:02:42 am »
Hello everybody
Does anybody know if there is a JPA UML profile (Java Persistence API) available for Enterprise Architect?
I am looking for a way to modelise and generate my EJB3 entity beans with their JPA annotations using a UML Profile.

I didn't found any "official" UML profile for JPA. But perhaps someone has already designed such a profile for EA ?

Thanks for any hints and kind regards
Sebastien

Yves.

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #1 on: October 30, 2008, 09:17:38 am »
Hi Sebastien,

I'm looking for the exact same thing. Looks like we'll have to work on it since nobody replies. If you ever consider going this way, please let me know, we may share the work to be done.

Yves.

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #2 on: October 30, 2008, 09:40:21 am »
EJB3 support is something we're looking at including in the future, although no firm plans or dates have been set in place at the moment.

EA does currently support
- Altering the appearance of an object based on stereotype (via Shapescripting)
- Annotations (via tagged values)
- Custom code generation and transformation templates

So the tools are all there if you need to make a start in the meantime.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

SebastienRoy

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #3 on: October 31, 2008, 03:46:50 am »
Ohoh !
In my wish list :
- Would it be possible to generate also the XML mapping file (or to switch between annotation generation and mapping file generation) ?
- An easily extensible mechanism would be appreciated, in order to add in the generation process, for instance, optimisation elements introduced by any vendor specific implementation of JPA.
- A model validation mechanism would also be appreciated, since properties related to some different annotations may be compatible or not. It would be nice to be able to detect such inconsistencies before deployment.

Yves.

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #4 on: October 31, 2008, 05:59:40 am »
Hi Sebastien,

I guess that what Micheal is essentially telling us is that all of your whish list is feasible as long as you are coding it on your own!!!

I had a look last week at the transformation template mechanism and it looks like we have there everything we would need to get proper code generation outputs. But I am affraid it will cost a little effort.

Are you ready to get involved in this direction?
Best regards,
Yves.

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #5 on: October 31, 2008, 08:51:45 am »
Sebastien,

You can augment the code generation process by modifying the code generation templates.

You could also perform your own validation through some additional logic provided by an add-in.

Here are some resources that would be worth looking at to give you more of an idea about how to navigate this area:

- An introduction to MDA transforms http://www.sparxsystems.com/resources/mda/
- An introduction to writing EA add-ins (in C#) http://www.sparxsystems.com/bin/CS_AddinFramework.zip
- A comprehensive 'MDA in Practice' whitepaper by Frank Truyen http://www.sparxsystems.com/downloads/whitepapers/EA4MDA_White_Paper_Practice.pdf
- The old EJB (pre v3) technology file http://www.sparxsystems.com/downloads/mdg_technology/EJB%20Technology.xml

Hope this helps to point you in the right direction
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

SebastienRoy

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #6 on: November 01, 2008, 12:32:41 am »
Thank you mrf for your support.
Thank you Yves for your proposition.

To my opinion, before diving into code writing, the first step would be to define precisely an EJB3 UML profile.
The definition of a JPA entity consists in :
- Java elements (class and attributes definition)
- JPA elements (annotations on classes and attributes)

The java elements are directly mapped by UML elements. They don't need any further developments
JPA specific elements consists in annotations, which may be customized by properties. These properties have a type, a value and a default value. So we are in presence of hierarchized information : Java element > Annotation > Annotation property
Furthermore, some annotations have sense only in presence of other annotations or values of other annotation properties (@PrimaryKeyJoinColumn is only used in conjunction with @Inheritance(strategy=InheritanceType.JOINED)).

In order to modelize these JPA elements, using UML elements we can use :
- UML base elements not already used by Java modelization
- Stereotypes
- Tagged values
- Something I forgot ?

@mrf : did SparxSystems began to define something about that ?
@Yves : I am very interested by a collaboration, but it would be better to use MP forum facility to communicate without having all the EA community getting bored...

Sebastien

Yves.

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #7 on: November 01, 2008, 01:04:55 am »
Thanks Sebastien,

From now on, I will use PM to contact you to keep work going. But I suggest to keep on using this thread only to update the status of where we are at since I suspect this work will be of interest for other folks.

Still awaiting Micheal's reply to your previous request though to figure out where to start from if any thinking has been done by Sparx in this matter so far.

Thanks again.
Yves.

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #8 on: November 04, 2008, 09:57:36 am »
Hello Yves and Sebastien,

I am currently on holidays and away from the office. I will be back next week (starting Monday 10th November) and will get back to you then.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

SebastienRoy

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #9 on: November 04, 2008, 07:34:19 pm »
Ok Michael, enjoy your hollidays !

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: UML Profile for JPA ?
« Reply #10 on: November 21, 2008, 09:00:11 am »
Hello Gentlemen,

Just a quick note to advise I've replied through PM
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8