开发者

AndroMDA maven code generation and JPA Annotations

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 U开发者_JS百科ML 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜