GenerateModel

From ADempiere
Revision as of 12:15, 10 May 2012 by Tbayen (Talk) (usage of the GenerateModel tool)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

If you want to extend the functionality of your Tables beyond the standard CRUD functionality of ADempiere and you want to add business functionality you have to declare a model of your Records. You can do this best with the GenerateModel class. There are some documents about this in the ADempiere Wiki:

There are still some secrets while using GenerateModel. So use this hints:

In the Run Configuration window of Eclipse you go to the "Arguments" Tab and enter the "program arguments" in this form (my example uses my FreiBier project at http://www.frei-bier.org):

 ${workspace_loc}/FreiBier/patches/org/compiere/model
 org.compiere.model
 'D'
 'I_Product'

You do not have to do it in separate lines, you can also take spaces to separate the arguments. You have to quote the last two arguments. The first argument is a directory that has to exist before running GenerateModel. The second argument is just a text that is included in the generated sourcecode as a "package ..." directive. The third argument is the Search Term of the Entity Type. The last is the table you want a model for.

One special Trick is to become a database connection for GenerateModel. The program has to find the file "Adempiere.properties" with your Database Connection parameters. You may do this with setting ADEMPIERE_HOME before starting it. For me it also worked to enter this in the text field for "VM arguments":

 -DPropertyFile=${workspace_loc}/FreiBier/Adempiere.properties

(You do not have to use the ${workspace_loc} Variable, but I like it so I can relocate my Eclipse workspace if I want)

-- User:Tbayen