Forums de discussion

Lock wait timeout exceeded; try restarting transaction

AA CC, modifié il y a 12 années.

Lock wait timeout exceeded; try restarting transaction

Junior Member Publications: 38 Date d'inscription: 31/05/11 Publications récentes
Hi,

i create a create account hook.
Into method onAfertCreate, i inserte this code above

                ArgUser argouser;
		User user = ((User)model);
	        argouser = ArgUserLocalServiceUtil.createArgUser((int)CounterLocalServiceUtil.increment(ArgUser.class.getName()));
	        argouser.setLruserId(user.getUserId());
	        ArgUserLocalServiceUtil.addArgUser(argouser);

The instruction ArgUserLocalServiceUtil.addArgUser(argouser); throw Lock wait timeout exceeded; try restarting transaction .
Why ?
in onAfertCreate the transaction for insert liferay user is still open ?

I'm using MySql

What i had to do ?
Is very urgent please help me.
thumbnail
Mika Koivisto, modifié il y a 12 années.

RE: Lock wait timeout exceeded; try restarting transaction

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
You should use a ServiceWrapper instead of ModelListener. When the model listener is invoked the transaction is still open. The transaction is committed after the addUser() service call returns (without throwing an exception).
AA CC, modifié il y a 12 années.

RE: Lock wait timeout exceeded; try restarting transaction

Junior Member Publications: 38 Date d'inscription: 31/05/11 Publications récentes
The i had to create a service with a new servicebuilter that remaps UserTable?
thumbnail
Mika Koivisto, modifié il y a 12 années.

RE: Lock wait timeout exceeded; try restarting transaction

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
Just create a hook plugin that defines a service hook in liferay-hook.xml and extends UserLocalServiceWrapper class and overrides addUser() method.