私たちはPlayフレームワークアプリケーションを2.3.10から2.4.8にアップグレードし、Ebean 3.xから4.6.2にアップグレードしています。javax.persistenceアノテーションに省略可能な要素がありませんか?
コンパイルエラーが表示され、javax.persistence
注釈にフィールドがないことがわかりました。両方のバージョンのEbeanは、バージョン1.0のjavax.persistence
に依存しています。
奇妙なことは、IntelliJが注釈にオプションの要素がないと表示していますが、注釈のJavadocにはオプションの要素が記載されています。そのコンパイルはまた、例えば
に失敗した注意してください、ここでIntelliJのはjavax.persistence.UniqueConstraint
のために示したソースは次のとおりです。
/**
* This annotation is used to specify that a unique constraint
* is to be included in the generated DDL for a primary or secondary table.
*
* <pre>
* Example:
* @Entity
* @Table(
* name="EMPLOYEE",
* uniqueConstraints=
* @UniqueConstraint(columnNames={"EMP_ID", "EMP_NAME"})
* )
* public class Employee { ... }
* </pre>
*
* @since Java Persistence 1.0
*/
@Target({TYPE})
@Retention(RUNTIME)
public @interface UniqueConstraint {
/** (Required) An array of the column names that make up the constraint. */
String[] columnNames();
}
「任意の」要素は何ですか? JPA 1.0を表示します。 JPA 2.0またはJPA 2.1が必要です。後のJPA API jarをビルドに統合し、JPAの後のバージョンのすべてのアノテーション属性を表示 –
JPA javadocも参照してください。JPA 2.0で「名前」が追加されています。https://docs.oracle.com /javaee/7/api/javax/persistence/UniqueConstraint.html#name-- –
ああ、そうです。これはおかしい;これまでJPA 2.xをインポートしていたに違いありません。それはとにかくそれを解決する。ありがとう! – evanjdooner