英文:
@UniqueConstraint: Array constants have to be specified using the `Array(...)' factory method
问题
我在一个用户模型上使用了`@UniqueConstraint`注解:
@Table(
name = "users",
uniqueConstraints = @UniqueConstraint(
columnNames = { "building_id", "pin" }
)
)
这个模型是一个基于Java 13的Play Framework 2.7项目的一部分。
当我尝试构建项目时,我收到一个错误:
[error] /app/models/common/User.java:25:27: 数组常量必须使用`Array(...)'工厂方法来指定
[error] uniqueConstraints = @UniqueConstraint(
[error] ^
根据[这个页面](https://www.objectdb.com/api/java/jpa/UniqueConstraint),应该是正确的。我不明白这个错误的原因。
英文:
I'm using the @UniqueConstraint
annotation on a User model:
@Table(
name = "users",
uniqueConstraints = @UniqueConstraint(
columnNames = { "building_id", "pin" }
)
)
This model is part of a Play Framework 2.7 project in Java 13.
When I want to build the project, I get an error:
[error] /app/models/common/User.java:25:27: Array constants have to be specified using the `Array(...)' factory method
[error] uniqueConstraints = @UniqueConstraint(
[error] ^
According to this page, it should be correct. I don't understand this error.
专注分享java语言的经验与见解,让所有开发者获益!
评论