views:

341

answers:

1

I am using the AndroMDA plugin for maven to generate code from an uml diagram made in MagicDraw.

When the code is generated, AndroMDA desings the JPA annotation for the persitence layer. I think that at the compilation process AndroMDA uses Naming Strategies to determine the Table and Column names for the DataBase.

I want to determine how AndroMDA desings this JPA annotations, because I need to display this DataBase names based on the UML entity and atributtes names.

I was regarding if there is an API of AndroMDA that I could use to do this by giving it the uml diagram. Or at least, to know the Naming Strategies used by AndroMDA to achive that.


AndroMDA at the compilation process design the JPA annotations for the Entities, Attributes, etc that are written in my java classes under a series of rules that exist within the EJB3 cartridge of AndroMDA. (The further Database is created using those JPA annotations).

I want to create a program that returns me the same Table and Attributes names wrote on the JPA annotations, by giving it the .xml file of the uml diagram of a project.

I was hoping that I could take advantage of the EJB3 cartridge to generate those Tables and Attribute names with my program. One way could be using an API of AndroMDA that do this(if it exits), or at least, by implementing the same rules used by the EJB3 cartridge for that matter.

To be more illustrative, For example:

If in my uml model I have an Entity called “CompanyGroup”, AndroMDA would generate the following code for the class definition:

@javax.persistence.Entity

@javax.persistence.Table(name = "COMPANY_GR")

Public class CompanyGroup implements java.io.Serializable, Comparable< CompanyGroup >

This is just an example (not a real case), but nevertheless, the way how AndroMDA do the translation from “CompanyGroup” to “COMPANY_GR” has to be specified somewhere.

Hope this explanation is useful enough.

Thanks.

A: 

As far as I know, the AndroMDA Maven Plugin is just a wrapper around the AndroMDA framework. So, if you want to customize anything, I think that you'll need to do it at the "cartridge" level (and the question is actually more an AndroMDA question than a Maven question).

Not sure which one you're using to generate JPA entities though (is it the EJB3 cartridge?) as you didn't provide any details but, well, you know where to look. Have a look at 10 steps to write a cartridge if you need some guidance.

Pascal Thivent
Thanks for your answer. And sorry for not giving much details.Yes, the cartridge being used is the EJB3 cartridge.So far, I had found in the repository of the AndroMDA EJB3 cartridge a series of templates. The template that writes in my java classes the JPA annotations is the Entity.vsl.In this template you can found code sentences like this ones:@[email protected](name = "${entity.tableName}")As you can see, this template feeds of an object that I still don’t know where AndroMDA builds it.Thanks for your help
ArsenioM
Sorry, but I don't get/understand what you're looking for :)
Pascal Thivent