Example usage for javax.persistence OptimisticLockException OptimisticLockException

List of usage examples for javax.persistence OptimisticLockException OptimisticLockException

Introduction

In this page you can find the example usage for javax.persistence OptimisticLockException OptimisticLockException.

Prototype

public OptimisticLockException(Object entity) 

Source Link

Document

Constructs a new OptimisticLockException exception with the specified entity.

Usage

From source file:com.vladmihalcea.service.impl.ItemServiceImpl.java

@Override
@Retry(times = 2, on = OptimisticLockException.class)
@Transactional//w  ww .ja v a2s. co m
public void saveItem() {
    incrementCalls();
    LOGGER.info("Save Item!");
    throw new OptimisticLockException("Save Item!");
}

From source file:com.vladmihalcea.service.impl.ItemServiceImpl.java

@Override
@Retry(times = 2, on = OptimisticLockException.class, failInTransaction = false)
@Transactional/*  w w w . java 2 s . c  o  m*/
public void saveItems() {
    incrementCalls();
    LOGGER.info("Save Items!");
    throw new OptimisticLockException("Save Items!");
}