@UniqueConstraint:数组常量必须使用`Array(…)`工厂方法来指定

huangapple 未分类评论75阅读模式
英文:

@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.

huangapple
  • 本文由 发表于 2020年8月14日 22:42:22
  • 转载请务必保留本文链接:https://java.coder-hub.com/63414962.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定