You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Kumaraswamy nandipati <ku...@ecomzera.com> on 2009/02/18 05:57:32 UTC

synchronize SequenceValueItem entity for XML imports

Hi Friends,

This is Kumaraswamy.

I am using ofbiz for my e-commerce application. I like the option data seed
through XML import which is provided in ofbiz.

 we are seeding the data for *InventoryItem* entity though XML import since
eariler. By doing this, The sequence Numbers are not updating in *
SequenceValueItem*. Now I am not able to create *InventoryItem* through
events(either JAVA or mini-lang),  its giving duplicate primary key error,
because of the sequence numbers are already used.

Of course, by doing max(sequenceId)+1 and store. That will be bad idea what
I feel. Is there any alternate for this. May be an ECA to update
*SequenceValueItem
*entity with new seqId for every InventoryItem XML import.

Generally, we do XML imports frequently for few entities. How to implement
generic ECA which will update *SequenceValueItem *for every entity which
uses sequenceId. Any code help will be appriciated.



Thanks in Advance

-- 
Thanks,
Kumaraswamy.N

Re: synchronize SequenceValueItem entity for XML imports

Posted by David E Jones <da...@hotwaxmedia.com>.
You'll see in the OFBiz demo data that for one time loading we usually  
just keep the numbers under 10000 so they don't conflict.

If you'll be doing it a lot, you might try a prefix per data source  
(isolated key spaces basically). The entity engine even support doing  
this for you (on the delegator element of the entityengine.xml file).

-David


On Feb 17, 2009, at 9:57 PM, Kumaraswamy nandipati wrote:

> Hi Friends,
>
> This is Kumaraswamy.
>
> I am using ofbiz for my e-commerce application. I like the option  
> data seed
> through XML import which is provided in ofbiz.
>
> we are seeding the data for *InventoryItem* entity though XML import  
> since
> eariler. By doing this, The sequence Numbers are not updating in *
> SequenceValueItem*. Now I am not able to create *InventoryItem*  
> through
> events(either JAVA or mini-lang),  its giving duplicate primary key  
> error,
> because of the sequence numbers are already used.
>
> Of course, by doing max(sequenceId)+1 and store. That will be bad  
> idea what
> I feel. Is there any alternate for this. May be an ECA to update
> *SequenceValueItem
> *entity with new seqId for every InventoryItem XML import.
>
> Generally, we do XML imports frequently for few entities. How to  
> implement
> generic ECA which will update *SequenceValueItem *for every entity  
> which
> uses sequenceId. Any code help will be appriciated.
>
>
>
> Thanks in Advance
>
> -- 
> Thanks,
> Kumaraswamy.N