You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by snehal <sn...@gmail.com> on 2011/09/13 14:15:36 UTC

adding new column in table

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.

Re: adding new column in table

Posted by prasanth r <pr...@gmail.com>.
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 <sn...@gmail.com> 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.
>

Re: adding new column in table

Posted by BJ Freeman <bj...@free-man.net>.
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.
> 

Re: adding new column in table

Posted by prasanth r <pr...@gmail.com>.
 Can you post the table structure which you have created?.






On Tue, Sep 13, 2011 at 6:08 PM, snehal <sn...@gmail.com> 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.
>

Re: adding new column in table

Posted by BJ Freeman <bj...@free-man.net>.
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.
> 

Re: adding new column in table

Posted by snehal <sn...@gmail.com>.
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.
http://ofbiz.135035.n4.nabble.com/file/n3819794/entityengine.xml
entityengine.xml 

Thanks
Snehal

--
View this message in context: http://ofbiz.135035.n4.nabble.com/adding-new-column-in-table-tp3809890p3819794.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: adding new column in table

Posted by Ravindra Mandre <ra...@gmail.com>.
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 <sn...@gmail.com> 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.
>

Re: adding new column in table

Posted by snehal <sn...@gmail.com>.
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.

Re: adding new column in table

Posted by Awdesh Parihar <aw...@gmail.com>.
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

Re: adding new column in table

Posted by snehal <sn...@gmail.com>.
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.

Re: adding new column in table

Posted by prasanth r <pr...@gmail.com>.
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
<ma...@antwebsystems.com>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.
>
>

Re: adding new column in table

Posted by Hans Bakker <ma...@antwebsystems.com>.
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.


Re: adding new column in table

Posted by snehal <sn...@gmail.com>.
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.