cancel
Showing results for 
Search instead for 
Did you mean: 

how to reset keygenerator?

Former Member
0 Kudos
1,693

Hi Team,

we have decided to change the template of one of our existing keygenerator. but the change is not taking effect. i got know that the specific bean of the keygenerator has to be reset.

Could you please let me know how to perform this reset using groovy / any on the fly fix(need any script but not java code level)?

Thanks, Srini

Accepted Solutions (1)

Accepted Solutions (1)

andyfletcher
Active Contributor
0 Kudos

To reset the orderCodeGenerator you can try this Groovy.

 orderCodeGenerator.setStart("1")
 orderCodeGenerator.reset()

That will reset on the server that you run it on and in the database. You'll need to restll other servers to get them to pick up a new batch of numbers from the new starting point as they'll still be using the old ones. To be safest I'd shutdown all nodes except one, run the Groovy and then start them back up again.

orderCodeGenerator is just the bean id of the PersistentKeyGenerator that you want to reset. It only works if it is marked resettable. Generators of type alphanumeric and numeric are resettable, uuid are not.

You could also reset it in the db if all Hybris nodes are shutdown

 update numberseries set currentValue='1'
 where serieskey='order_code'

order_code is the key property of the orderCodeGenerator bean.

Answers (0)