Foros de discusión

transaction management in liferay mvc portlet class

thumbnail
francesco scamarcio, modificado hace 10 años.

transaction management in liferay mvc portlet class

New Member Mensajes: 6 Fecha de incorporación: 11/03/14 Mensajes recientes
hi,

I have developed a portlet with liferay portlet mvc. I created two ENTITIES A and B and each of these entities has a method to add data into it tables.
As I can handle transactions in liferay from the controller class method if one of the two portlet fails?
thumbnail
David H Nebinger, modificado hace 10 años.

RE: transaction management in liferay mvc portlet class

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
If you used service builder, transactions are managed at the service tier and are done through the method names (those prefixed w/ obvious changing words such as "add" or "delete" will be wrapped in a regular txn, non changers like "get" will be wrapped in a read only txn).
thumbnail
francesco scamarcio, modificado hace 10 años.

RE: transaction management in liferay mvc portlet class

New Member Mensajes: 6 Fecha de incorporación: 11/03/14 Mensajes recientes
thank you David,

my question is if i hae to call two entities method in a controller how can i manage the two call with a unique transaction? is posible to do that in a controller method? or the transaction is only applied to service tier?
thumbnail
Juan Gonzalez, modificado hace 10 años.

RE: transaction management in liferay mvc portlet class

Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
Hola Francesco,

did you try adding a method for this purpose in one entity xxxServiceImpl and adding reference for other entitiies in service.xml? After ServiceBuilder is executed, there will be some available references for those entities services/persistence classes.

Then you can use this method (transaction aware) from your portlet class.