on 2018 Mar 02 10:58 AM
Hi Experts,
hybris automatically generate pk when saving model.But the mechanism is not clear to me.
Could you please explain the process?
Thanks in advance.
Request clarification before answering.
Hi Devin,
Please check the de.hybris.platform.core.PK.createFixedUUIDPK method if you have decompiler.
Refer https://help.hybris.com/6.6.0/hcd/8c2d4abd866910149207b2f33deaf652.html as well,
Note : Hybris creates PK using type code, cluster id(default 0), creation time and it will apply bitwise operation to generate PK.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Devin,
The business case related to this request needs to be evaluated on ROI and Upgradablility.
Perhaps, this can be implemented higher in the hybris stack, and it will be easier to migrate to a later version of hybris. I would suggest that you investigate the AfterSaveListener:
public class ProductUpdateAfterSaveListener implements AfterSaveListener {
@Inject private ModelService modelService;
@Override public void afterSave(final Collection<AfterSaveEvent> events) {
for (final AfterSaveEvent event : events) {
if (AfterSaveEvent.UPDATE == event.getType()) {
//The product deployment code is "1"
if (1 == event.getPk().getTypeCode()) {
final ProductModel product = modelService.get(event.getPk());
//Put your business code here
}
After Save Listener Documentation for 6.6.
Otherwise, a faster option for you to get an answer would be to decompile the software and debug it.
Regards,
Luke
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.