JavaFX BooleanProperty 和 Hibernate
JavaFX BooleanProperty and Hibernate
我正在尝试将 JavaFX BooleanPropety 添加到由 Hibernate 保留的模型中,但出现以下错误。
Caused by: org.hibernate.MappingException: Could not determine type for: javafx.beans.property.BooleanProperty.
JavaFX StringProperty 坚持得很好,所以我有点困惑。
我的模型class如下
@Entity
public class Currency {
private String uuid;
private BooleanProperty isDefault = new SimpleBooleanProperty();
private StringProperty name = new SimpleStringProperty();
private StringProperty code = new SimpleStringProperty();
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
@Column(name = "id")
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name.get();
}
public void setName(String name) {
this.name.set(name);
}
public String getCode() {
return code.get();
}
public void setCode(String code) {
this.code.set(code);
}
public boolean getIsDefault() {
return isDefault.get();
}
public void setIsDefault(boolean isDefault) {
this.isDefault.set(isDefault);
}
public StringProperty nameProperty() {
return name;
}
public StringProperty codeProperty() {
return code;
}
public BooleanProperty isDefaultProperty(){
return isDefault;
}
}
正在重命名
private BooleanProperty isDefault;
至
private BooleanProperty default;
问题解决。原因是布尔字段的命名约定在 java 中非常不同。下文对此进行了解释 link
我正在尝试将 JavaFX BooleanPropety 添加到由 Hibernate 保留的模型中,但出现以下错误。
Caused by: org.hibernate.MappingException: Could not determine type for: javafx.beans.property.BooleanProperty.
JavaFX StringProperty 坚持得很好,所以我有点困惑。
我的模型class如下
@Entity
public class Currency {
private String uuid;
private BooleanProperty isDefault = new SimpleBooleanProperty();
private StringProperty name = new SimpleStringProperty();
private StringProperty code = new SimpleStringProperty();
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
@Column(name = "id")
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name.get();
}
public void setName(String name) {
this.name.set(name);
}
public String getCode() {
return code.get();
}
public void setCode(String code) {
this.code.set(code);
}
public boolean getIsDefault() {
return isDefault.get();
}
public void setIsDefault(boolean isDefault) {
this.isDefault.set(isDefault);
}
public StringProperty nameProperty() {
return name;
}
public StringProperty codeProperty() {
return code;
}
public BooleanProperty isDefaultProperty(){
return isDefault;
}
}
正在重命名
private BooleanProperty isDefault;
至
private BooleanProperty default;
问题解决。原因是布尔字段的命名约定在 java 中非常不同。下文对此进行了解释 link