adding new column in table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

adding new column in table

snehal
Hi,

I want to add one new column in existing entity. I have modified entity definition for this new column entry in entityModel.xml and restarted the ofbiz.

But new column is not added in database. I can not drop the current entity.

Could you please tell me to modify existing table definitions in database using ofbiz?

Thanks
Snehal
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

snehal
I am using apache-ofbiz-09.04 version.
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

prasath
In reply to this post by snehal
Hi,

 You should use <extend-entity>  to modify the table structure. If you did
so, then you have to check your entityengine.xml. In this file check tables
on start up  option should be enabled.

regards
prasath rajan



On Tue, Sep 13, 2011 at 5:45 PM, snehal <[hidden email]> wrote:

> Hi,
>
> I want to add one new column in existing entity. I have modified entity
> definition for this new column entry in entityModel.xml and restarted the
> ofbiz.
>
> But new column is not added in database. I can not drop the current entity.
>
> Could you please tell me to modify existing table definitions in database
> using ofbiz?
>
> Thanks
> Snehal
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3809890.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

hans_bakker
In reply to this post by snehal
look for error or warning messages in the log and check in webtools if
the column is really not added....

On Tue, 2011-09-13 at 05:17 -0700, snehal wrote:
> I am using apache-ofbiz-09.04 version.
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3809899.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

--
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Alternative ofbiz website: http://www.ofbiz.info
http://www.antwebsystems.com : Quality services for competitive rates.

Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

prasath
Hi,

In entityengine.xml
check following settings

check-on-start=true
add-missing-on-start=true

regards
prasath rajan





On Tue, Sep 13, 2011 at 5:52 PM, Hans Bakker
<[hidden email]>wrote:

> look for error or warning messages in the log and check in webtools if
> the column is really not added....
>
> On Tue, 2011-09-13 at 05:17 -0700, snehal wrote:
> > I am using apache-ofbiz-09.04 version.
> >
> > --
> > View this message in context:
> http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3809899.html
> > Sent from the OFBiz - User mailing list archive at Nabble.com.
>
> --
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Alternative ofbiz website: http://www.ofbiz.info
> http://www.antwebsystems.com : Quality services for competitive rates.
>
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

snehal
Yes. I have both the settings added in entityengine.
Do I have to replace <entity> tag with  <extend-entity> tag to modify table structure?
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

Awdesh Parihar-2
Hi Snehal,



> Do I have to replace <entity> tag with  <extend-entity> tag to modify table
>

Yes, for adding new column you need to extend existing entity.
For ex :

    <extend-entity entity-name="PartyGroup">
        <field name="xyz" type="name"/>
    </extend-entity>

--
Awdesh
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

prasath
In reply to this post by snehal
 Can you post the table structure which you have created?.






On Tue, Sep 13, 2011 at 6:08 PM, snehal <[hidden email]> wrote:

> Yes. I have both the settings added in entityengine.
> Do I have to replace <entity> tag with  <extend-entity> tag to modify table
> structure?
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3809946.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
prasath rajan 9442369696
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

BJ Freeman
In reply to this post by snehal
you created a new element that has <extend-entity> instead of <entity>
then add you fields you want to add.

snehal sent the following on 9/13/2011 5:38 AM:
> Yes. I have both the settings added in entityengine.
> Do I have to replace <entity> tag with  <extend-entity> tag to modify table
> structure?
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3809946.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

snehal
In reply to this post by snehal
Hi,

This is my entity definition



        <entity entity-name="PartRevPlantRelation" package-name="com.prorigo.dataloader" title="Entity for PartRevPlantRelation information">
                <field name="partRevId" type="numeric"></field>
                <field name="plantId" type="numeric"></field>
                <field name="startDate" type="date"></field>
                <field name="qtyInOrder" type="numeric"></field>
                <field name="lastOrderDelivDate" type="date"></field>
                <field name="firstOrderDelivDate" type="date"></field>
                <prim-key field="partRevId"/>
                <prim-key field="plantId"/>
                <relation type="one" fk-name="FK_PART_REV_PLANT_RELATION_PART_REV_ID" rel-entity-name="PartRevision">
                        <key-map field-name="partRevId" rel-field-name="partRevisionId"/>
                </relation>
                <relation type="one" fk-name="FK_PART_REV_PLANT_RELATION_PLANT_ID" rel-entity-name="Plant">
                        <key-map field-name="plantId" />
                </relation>
        </entity>


I want to add one more column called testQty. In this table.

Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

BJ Freeman
this is not an Ofbiz Entity so you have a couple of choices.
if you not a production server, in development just add the fields to
the entity.
if you in productions then use the best practices for changing entities.
section "Deprecating entities" at
https://cwiki.apache.org/OFBADMIN/ofbiz-contributors-best-practices.html


snehal sent the following on 9/13/2011 7:21 AM:

> Hi,
>
> This is my entity definition
>
>
>
> <entity entity-name="PartRevPlantRelation"
> package-name="com.prorigo.dataloader" title="Entity for PartRevPlantRelation
> information">
> <field name="partRevId" type="numeric"></field>
> <field name="plantId" type="numeric"></field>
> <field name="startDate" type="date"></field>
> <field name="qtyInOrder" type="numeric"></field>
> <field name="lastOrderDelivDate" type="date"></field>
> <field name="firstOrderDelivDate" type="date"></field>
> <prim-key field="partRevId"/>
> <prim-key field="plantId"/>
> <relation type="one" fk-name="FK_PART_REV_PLANT_RELATION_PART_REV_ID"
> rel-entity-name="PartRevision">
> <key-map field-name="partRevId" rel-field-name="partRevisionId"/>
> </relation>
> <relation type="one" fk-name="FK_PART_REV_PLANT_RELATION_PLANT_ID"
> rel-entity-name="Plant">
> <key-map field-name="plantId" />
> </relation>
> </entity>
>
>
> I want to add one more column called testQty. In this table.
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3810205.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

Ravindra Mandre-2
In reply to this post by snehal
If your entity exists in database what you are using then do the extend
entity like
<extend-entity entity-name="PartRevPlantRelation">
<field name="testQty" type="numeric" />
</extend-entity>


Hope this helps you


Ravindra Mandre












On Tue, Sep 13, 2011 at 7:51 PM, snehal <[hidden email]> wrote:

> Hi,
>
> This is my entity definition
>
>
>
>        <entity entity-name="PartRevPlantRelation"
> package-name="com.prorigo.dataloader" title="Entity for
> PartRevPlantRelation
> information">
>                <field name="partRevId" type="numeric"></field>
>                <field name="plantId" type="numeric"></field>
>                <field name="startDate" type="date"></field>
>                <field name="qtyInOrder" type="numeric"></field>
>                <field name="lastOrderDelivDate" type="date"></field>
>                <field name="firstOrderDelivDate" type="date"></field>
>                <prim-key field="partRevId"/>
>                <prim-key field="plantId"/>
>                <relation type="one"
> fk-name="FK_PART_REV_PLANT_RELATION_PART_REV_ID"
> rel-entity-name="PartRevision">
>                        <key-map field-name="partRevId"
> rel-field-name="partRevisionId"/>
>                </relation>
>                <relation type="one"
> fk-name="FK_PART_REV_PLANT_RELATION_PLANT_ID"
> rel-entity-name="Plant">
>                        <key-map field-name="plantId" />
>                </relation>
>        </entity>
>
>
> I want to add one more column called testQty. In this table.
>
>
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3810205.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: adding new column in table

snehal
Hi All,

Thanks for your reply. I tried this in my environment but it did not work. I am using oracle database.
Please find attached entityengine.xml file I am using. check-on-start and add-missing-on-start attributes are true for datasource.

Please let me know if I am missing any specific thing in configuration.entityengine.xml

Thanks
Snehal