我收到以下异常-java.lang.NoSuchFieldError:PESSIMISTIC_FORCE_INCREMENT

时间:2019-11-15 10:29:23

标签: java hibernate jpa

出现以下错误

SEVERE: Servlet.service() for servlet [spring-servlet] in context with path [/sigma] threw exception [Handler processing failed; nested exception is java.lang.NoSuchFieldError: PESSIMISTIC_FORCE_INCREMENT] with root cause
java.lang.NoSuchFieldError: PESSIMISTIC_FORCE_INCREMENT

在线出现错误

FallbackPnr fallbackPnr = entityManager.find(FallbackPnr.class, searchDate, LockModeType.PESSIMISTIC_FORCE_INCREMENT);

从javaee-api-7.0.jar获取LockModeType

FallBackPnr.java

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name= "super_pnr_counter")
public class FallbackPnr {

    @Id
    @Column(name="id")
    private String id;

    @Version
    @Column(name="version")
    private int version;

    @Column(name = "updated_on")
    private Date updatedOn;

   //getters and setters
}

0 个答案:

没有答案