I am working on an application that uses liferay framework. There is a registration portlet that registers the user in liferay and also inserting an entry into my application database mapping table with the liferay userid.
I want both tasks should be in one transaction only, if my mapping table entry fails I want to revert back the user creation in liferay.
Can I have a transaction in my application by overriding the liferay's transaction to rollback for my own exception?
If you're familiar with Liferay's Service Layer then you can use that to perform CRUD operations on entities like User in Liferay's configured database. If you use the built-in methods to create a user in order to generate the new userId, you can subsequently delete the user if the mapping table operation fails.