I have a requirement which is as follows. Lets say I have a XML file which contains the following content.
<?xml version="1.0"?>
<items>
<item id="1" class="Company" interface="true">
</item>
<item id="2" class="MyCompany" implements="Company">
<attribute name="name" value="CompanyB"/>
<attribute name="vatNumber" value="5678"/>
<reference name="CEO" ref_id="11"/>
<reference name="address" ref_id="19"/>
<collection name="contractors">
<reference ref_id="4"/>
<reference ref_id="3"/>
</collection>
<collection name="departments">
<reference ref_id="7"/>
<reference ref_id="6"/>
</collection>
<collection name="oldContracts">
<reference ref_id="4"/>
<reference ref_id="3"/>
</collection>
<collection name="secretarys">
<reference ref_id="14"/>
<reference ref_id="15"/>
</collection>
</item>
</items>
I want to have a convertor to convert this items file into database tables directly and on the same time generate model classes for each type of items. So than I can have a modelservice to control them .Also when i add more attributes to the type it should be able to update the database table and the model code automatically.
In more better way I require some kind of model code generator which create database tables and maps them both in a well planned manner ?
Is some kind of tool already avaiable to do this type of buisness logic.??? I don’t like to reinvent the wheel again.?
Actually after little googling I came across Apache Torque which looks awesome from my needs.