AndroMDA maven code generation and JPA Annotations

Posted by ArsenioM on Stack Overflow See other posts from Stack Overflow or by ArsenioM
Published on 2010-01-11T16:24:46Z Indexed on 2010/03/09 1:06 UTC
Read the original article Hit count: 868

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about maven-2