將 unitName 屬性用於「注入的 JPA」元素

此規則會偵測某些 JPA PeristenceContext 或 PersistenceUnit 註釋,其中欄位名稱與定義於 persistence.xml 檔的持續性單元名稱相同。 此規則可能要求存取 persistence.xml 檔,該檔案必須位於 META-INF 資料夾內。 下列條件會觸發該規則:

自動修正將新增屬性 unitName 及/或 name 至 JPA PeristenceContext 或 PersistenceUnit 註釋。


範例: