A previous comment that says :
Do you have this issue for a specific type ? if yes ! You can think to change the deployment table numbre to get a new PK.
this gave me the idea that changing the current counter for PK generation would be the solution, then I prepared a groovy script to do it.
For example, We have order type XML representation defined with typecode : 45.
<itemtype code="Order" extends="AbstractOrder" jaloclass="de.hybris.platform.jalo.order.Order" generate="true" singleton="false" jaloonly="false" autocreate="true">
<deployment table="orders" typecode="45"/>
so the groovy file to change its counter is :
import de.hybris.platform.core.Registry;
import de.hybris.platform.core.PK.PKCounterGenerator;
import de.hybris.platform.persistence.numberseries.SerialNumberGenerator;
int key = 45;
int current = new de.hybris.platform.core.DefaultPKCounterGenerator().fetchNextCounter(key);
SerialNumberGenerator generator = Registry.getCurrentTenant().getSerialNumberGenerator();
generator.removeSeries("pk_"+key);
generator.createSeries("pk_"+key,1,current*10)
The current solution, solved the issue just for Orders Table. Next step is to make it happen for all tables, this won't be difficult if we use the table numberseries to fetch all existing serieskeys.