[英]javax.persistence annotations missing optional elements?
我們正在將Play框架應用程序從2.3.10升級到2.4.8,並隨之從Ebean 3.x升級到4.6.2。
我現在看到編譯錯誤,指出某些javax.persistence
注釋缺少字段。 這兩個版本的Ebean都依賴於javax.persistence
1.0版本。
奇怪的是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(在構建過程中的某個位置,以及IDEA會顯示的內容)。 JPA 2.0中引入了UniqueConstraint批注的“名稱”屬性。 您需要更改IDEA的版本才能使用JPA 2.0。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.