Adding a new entity under product package ?

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

Adding a new entity under product package ?

gopalbi
Hello friends,

     Actually i have to add a new entity under product package that will create a new table in ofbiz.Few field in this table totally a new one.While saving the data in this table only those field are save while are present in product table.like productId and description and other field are not save like size, color. But if we put a copy of these field in the product table then it will be save.

Example(Condition 1)
Entity 1

<extend-entity entity-name="Product"> 
        <field name="productId" type="id-ne"></field> 
        <field name="description" type="description"></field> 
    </extend-entity> 
Entity 2

<extend-entity entity-name="Xyz"> 
        <field name="productId" type="id-ne"></field> 
        <field name="description" type="description"></field> 
        <field name="coloring" type="long-varchar"></field> 
 

    </extend-entity> 
// The color field data is not saving in Xyz table only those field are save while are present in product table


Condition 2
Entity 1

<extend-entity entity-name="Product"> 
        <field name="productId" type="id-ne"></field> 
        <field name="description" type="description"></field> 
        <field name="coloring" type="long-varchar"></field> 
    </extend-entity> 
Entity 2

<extend-entity entity-name="Xyz"> 
        <field name="productId" type="id-ne"></field> 
        <field name="description" type="description"></field> 
        <field name="coloring" type="long-varchar"></field> 
 

    </extend-entity> 
// But if we put a copy of these coloring field in the product table then it will be save.

But please give me a proper solution.

Thanks & Regards:
 Gopal
Reply | Threaded
Open this post in threaded view
|

Re: Adding a new entity under product package ?

Scott Gray
Where is the new entity definition for "Xyz" and why are you using
extend-entity on it?

-Scott

2008/7/29 gopalbi <[hidden email]>:

>
> Hello friends,
>
>     Actually i have to add a new entity under product package that will
> create a new table in ofbiz.Few field in this table totally a new one.While
> saving the data in this table only those field are save while are present in
> product table.like productId and description and other field are not save
> like size, color. But if we put a copy of these field in the product table
> then it will be save.
>
> Example(Condition 1)
> Entity 1
>
> <extend-entity entity-name="Product">
>        <field name="productId" type="id-ne"></field>
>        <field name="description" type="description"></field>
>    </extend-entity>
> Entity 2
>
> <extend-entity entity-name="Xyz">
>        <field name="productId" type="id-ne"></field>
>        <field name="description" type="description"></field>
>        <field name="coloring" type="long-varchar"></field>
>
>
>    </extend-entity>
> // The color field data is not saving in Xyz table only those field are save
> while are present in product table
>
>
> Condition 2
> Entity 1
>
> <extend-entity entity-name="Product">
>        <field name="productId" type="id-ne"></field>
>        <field name="description" type="description"></field>
>        <field name="coloring" type="long-varchar"></field>
>    </extend-entity>
> Entity 2
>
> <extend-entity entity-name="Xyz">
>        <field name="productId" type="id-ne"></field>
>        <field name="description" type="description"></field>
>        <field name="coloring" type="long-varchar"></field>
>
>
>    </extend-entity>
> // But if we put a copy of these coloring field in the product table then it
> will be save.
>
> But please give me a proper solution.
>
> Thanks & Regards:
>  Gopal
>
> --
> View this message in context: http://www.nabble.com/Adding-a-new-entity-under-product-package---tp18705654p18705654.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Adding a new entity under product package ?

anil.soni
 Gopal,

If you want to create a new entity in Product package then you can do like
this:

<entity entity-name="Xyz"
    *package*-name="org.ofbiz.product.product" title="Xyz Entity">
  <field name="xyzId" type="id-ne"></field>
  <field name="xyzDescription" type="description"></field>
  <field name="zyzColoring" type="long-varchar"></field>
  <prim-key field="xyzId"/>
  <relation type="one/many" fk-name="XYZ_TYP" rel-entity-name="XyzType">
    <key-map field-name="xyzId"/>
  </relation>
</entity>

or if you want to extends existing product entity with some new fields then
you can do like this:

<extend-entity entity-name="Product">
       <field name="field1" type="fieldType"></field>
       <field name="field2" type="fieldType"></field>
</extend-entity>

If you would like to extend any entity then make sure you have the
definition for this entity.

I hope it will helpfull for you.

On 7/29/08, Scott Gray <[hidden email]> wrote:

>
> Where is the new entity definition for "Xyz" and why are you using
> extend-entity on it?
>
> -Scott
>
> 2008/7/29 gopalbi <[hidden email]>:
> >
> > Hello friends,
> >
> >     Actually i have to add a new entity under product package that will
> > create a new table in ofbiz.Few field in this table totally a new
> one.While
> > saving the data in this table only those field are save while are present
> in
> > product table.like productId and description and other field are not save
> > like size, color. But if we put a copy of these field in the product
> table
> > then it will be save.
> >
> > Example(Condition 1)
> > Entity 1
> >
> > <extend-entity entity-name="Product">
> >        <field name="productId" type="id-ne"></field>
> >        <field name="description" type="description"></field>
> >    </extend-entity>
> > Entity 2
> >
> > <extend-entity entity-name="Xyz">
> >        <field name="productId" type="id-ne"></field>
> >        <field name="description" type="description"></field>
> >        <field name="coloring" type="long-varchar"></field>
> >
> >
> >    </extend-entity>
> > // The color field data is not saving in Xyz table only those field are
> save
> > while are present in product table
> >
> >
> > Condition 2
> > Entity 1
> >
> > <extend-entity entity-name="Product">
> >        <field name="productId" type="id-ne"></field>
> >        <field name="description" type="description"></field>
> >        <field name="coloring" type="long-varchar"></field>
> >    </extend-entity>
> > Entity 2
> >
> > <extend-entity entity-name="Xyz">
> >        <field name="productId" type="id-ne"></field>
> >        <field name="description" type="description"></field>
> >        <field name="coloring" type="long-varchar"></field>
> >
> >
> >    </extend-entity>
> > // But if we put a copy of these coloring field in the product table then
> it
> > will be save.
> >
> > But please give me a proper solution.
> >
> > Thanks & Regards:
> >  Gopal
> >
> > --
> > View this message in context:
> http://www.nabble.com/Adding-a-new-entity-under-product-package---tp18705654p18705654.html
> > Sent from the OFBiz - User mailing list archive at Nabble.com.
> >
> >
>



--
Anil Soni
Software Engineer
Contact no.- +91-9892271357
Reply | Threaded
Open this post in threaded view
|

Re: Adding a new entity under product package ?

BJ Freeman
In reply to this post by gopalbi
I guess my question is why do yo feel a need to make or change an entity
 for color or size when you can use the productfeatures.

gopalbi sent the following on 7/28/2008 10:34 PM:

> Hello friends,
>
>      Actually i have to add a new entity under product package that will
> create a new table in ofbiz.Few field in this table totally a new one.While
> saving the data in this table only those field are save while are present in
> product table.like productId and description and other field are not save
> like size, color. But if we put a copy of these field in the product table
> then it will be save.
>
> Example(Condition 1)
> Entity 1
>
> <extend-entity entity-name="Product">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>     </extend-entity>
> Entity 2
>
> <extend-entity entity-name="Xyz">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>         <field name="coloring" type="long-varchar"></field>
>  
>
>     </extend-entity>
> // The color field data is not saving in Xyz table only those field are save
> while are present in product table
>
>
> Condition 2
> Entity 1
>
> <extend-entity entity-name="Product">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>         <field name="coloring" type="long-varchar"></field>
>     </extend-entity>
> Entity 2
>
> <extend-entity entity-name="Xyz">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>         <field name="coloring" type="long-varchar"></field>
>  
>
>     </extend-entity>
> // But if we put a copy of these coloring field in the product table then it
> will be save.
>
> But please give me a proper solution.
>
> Thanks & Regards:
>  Gopal
>

Reply | Threaded
Open this post in threaded view
|

Re: Adding a new entity under product package ?

BJ Freeman
In reply to this post by gopalbi
Also you can save data in a context of a session and don't need an entity.

gopalbi sent the following on 7/28/2008 10:34 PM:

> Hello friends,
>
>      Actually i have to add a new entity under product package that will
> create a new table in ofbiz.Few field in this table totally a new one.While
> saving the data in this table only those field are save while are present in
> product table.like productId and description and other field are not save
> like size, color. But if we put a copy of these field in the product table
> then it will be save.
>
> Example(Condition 1)
> Entity 1
>
> <extend-entity entity-name="Product">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>     </extend-entity>
> Entity 2
>
> <extend-entity entity-name="Xyz">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>         <field name="coloring" type="long-varchar"></field>
>  
>
>     </extend-entity>
> // The color field data is not saving in Xyz table only those field are save
> while are present in product table
>
>
> Condition 2
> Entity 1
>
> <extend-entity entity-name="Product">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>         <field name="coloring" type="long-varchar"></field>
>     </extend-entity>
> Entity 2
>
> <extend-entity entity-name="Xyz">
>         <field name="productId" type="id-ne"></field>
>         <field name="description" type="description"></field>
>         <field name="coloring" type="long-varchar"></field>
>  
>
>     </extend-entity>
> // But if we put a copy of these coloring field in the product table then it
> will be save.
>
> But please give me a proper solution.
>
> Thanks & Regards:
>  Gopal
>