Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Unable to add address data in address table using ContactModelListener
Hi Guys,
I am developing ContactModelListener, in which i am trying to add data into address table using onBeforeCreate() event and onAfterCreate() event , but after trying both event listener method one after another, data is not storing in address table, also there is no exception occurs during method execution, I have attached code, please help.
Environment : Liferay 7.1 CE GA2
I am developing ContactModelListener, in which i am trying to add data into address table using onBeforeCreate() event and onAfterCreate() event , but after trying both event listener method one after another, data is not storing in address table, also there is no exception occurs during method execution, I have attached code, please help.
Environment : Liferay 7.1 CE GA2
Attachments:
Hmm, are you sure the component is even running?
Also, I cringe when I see "e.printStackTrace()" in code since you have no idea where it might actually go. It is so easy to instantiate a logger and using it guarantees where it will go, so why not just do it right from the outset?
Also, I cringe when I see "e.printStackTrace()" in code since you have no idea where it might actually go. It is so easy to instantiate a logger and using it guarantees where it will go, so why not just do it right from the outset?
Hi David,
I have done changes as per your suggestion but i am not getting success and also i have checked that component is running PFA.
I have done changes as per your suggestion but i am not getting success and also i have checked that component is running PFA.
Attachments:
Hi Rahul,
Try log inside onAfterCreate or onBeforeCreate before the service triggers and after.
Try log inside onAfterCreate or onBeforeCreate before the service triggers and after.
Hi Zubair,
Actually i have debug code line by line and code is working without any exception, but after service execution(_addressLocalService.addAddress(address);) when i am going to check data in address table, data is not there.
Actually i have debug code line by line and code is working without any exception, but after service execution(_addressLocalService.addAddress(address);) when i am going to check data in address table, data is not there.
Does the contact get added to the DB? Can you check if the current transaction is read-only (eg triggered by a localService.getXMethod())?
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™