synchronize SequenceValueItem entity for XML imports

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

synchronize SequenceValueItem entity for XML imports

Kumaraswamy nandipati
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
Reply | Threaded
Open this post in threaded view
|

Re: synchronize SequenceValueItem entity for XML imports

David E Jones-3

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