PSD 属性 访问 isMethod

JPA property access isMethod

JPA 属性 访问:getter 和 setter。它支持布尔值的 isMethod 吗?例如,

@Entity
@Access(AccessType.PROPERTY)   
public class Foo {
   private boolean closed;


   public boolean isClosed() {
       return this.closed;
   }

}

在 JPA 规范 2.1 中找不到相关信息。

是的。是的。

来自JSR 338: JavaTM Persistence API, Version 2.1

2.2 Persistent Fields and Properties

...for every persistent property property of type T of the entity, there is a getter method, getProperty, and setter method setProperty. For boolean properties, isProperty may be used as an alternative name for the getter method.