Blog Archive

AndroMDA Command to generate tables


AndroMDA is a Model Driven Architecture and in this post I am not going to explain about this great utility Code Generation tool. This post is to enlighten people how easily you can generate the SQL statements if you use AnrdoMDA....All you need to do is properly model the Entities (Tables) and the relationship among them with the hlp of modeling tools like Argo UML or RSA or even Magic Draw for that matter.

Command to generate TABLE SCHEMA

mvn -f core/pom.xml andromdapp:schema -Dtasks=create

Well most people try to do this but they get

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An error occurred while attempting to create the schema

Embedded error: java.lang.ClassNotFoundException: org.postgresql.Driver

You get Postgres.Driver error if you are using Postgres db and Mysql driver error if you are using Mysql db.

The problem is because you have failded to change the /core.pom.xml. This is the most important trick.Search for <executescripts> tag and change the value from true to false.

VALUE FOUND IN {Project location}\core\pom.xml

<executescripts>true</executescripts>

Change value in {Project location}\core\pom.xml
<executeScripts> false </executeScripts>

The resultant SQL file will be found in {Project location}/app/target/schema-create.sql.

Now all you need to do is run this SQL script in the database. The tables are created.