単項演算子を使用してJPAでブール値を設定できるかどうかを知りたい。 私は有効フィールドは、これは結果JPA単項演算子
Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: expecting '=', found 'c' [update com.nicinc.Computer com set com.enabled=!com.enabled where com.id = ?1]
ある
boolean(1)
として格納されているDBでPOJO
private Boolean enabled;
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
でこのようにマッピングされている。この
@Modifying
@Query("update Computer com set com.enabled=!com.enabled where com.id = ?1")
のようなものを意味します
ここではJPAのプロパティ
春データJPAプロパティ
spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
エラーが発生しますか?それとも単にあなたのために働いていない? –
コンピュータマッピングクラスを追加できますか?特にブール値フィールド。 –
テーブルの列のデータ型は何ですか? –