Forums de discussion

Getting org.hibernate.exception.ConstraintViolationException

Alex Man, modifié il y a 6 années.

Getting org.hibernate.exception.ConstraintViolationException

Junior Member Publications: 70 Date d'inscription: 08/02/16 Publications récentes
I am using a serviceBuilder project in which I will use the build generated update method for updating or creating a row in the entity. The application is using by many people. Sometimes I am getting the following exception, is it because of the counter mispatch?

{"exception":"com.liferay.portal.kernel.dao.orm.ORMException","message":"org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update"}


Can anyone please help me on this
thumbnail
David H Nebinger, modifié il y a 6 années.

RE: Getting org.hibernate.exception.ConstraintViolationException

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
Hard to say, this error doesn't give any details such as what entity is broken or any stack trace information.

You mention the counter, I guess because you might have some insight that suggests there may be contention there. If you're using the CounterLocalService instance available inside of your service layer to assign counter values, you shouldn't have any collisions there to worry about.






Come meet me at the 2017 LSNA!
Alex Man, modifié il y a 6 années.

RE: Getting org.hibernate.exception.ConstraintViolationException

Junior Member Publications: 70 Date d'inscription: 08/02/16 Publications récentes
David H Nebinger:
Hard to say, this error doesn't give any details such as what entity is broken or any stack trace information.

You mention the counter, I guess because you might have some insight that suggests there may be contention there. If you're using the CounterLocalService instance available inside of your service layer to assign counter values, you shouldn't have any collisions there to worry about


Can we have any issues such as:
1. Lets say if it accessible to 100's of users, if they parallely triggers some update action for an entity, does that counter works correctly.
2. If I restart the liferay server, but service builder does not trigger the table updation since the build version is lower in db
thumbnail
David H Nebinger, modifié il y a 6 années.

RE: Getting org.hibernate.exception.ConstraintViolationException (Réponse)

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
The counter class has been well tested over like 10 years now under more load than you're going to send at it.

I don't understand #2. If it was deployed and working before the shutdown, it will remain working after restart.









Come meet me at the 2017 LSNA!