EclipseLink注释错误

时间:2018-02-21 15:10:23

标签: eclipse jpa eclipselink

我已经从现有数据库中生成了一些实体,并且我已经添加了jars - elipselink.jar和javax.persistence_2.2.0.v201708071007.jar来构建路径 - >配置构建路径。我有14个实体和14个错误:

  

Class" model.Attribute"在persistence.xml文件中列出,但未注释

即使"导入生成"添加了@Entity注释:

@Entity
@NamedQuery(name="Attribute.findAll", query="SELECT a FROM Attribute a")
public class Attribute implements Serializable {

所有实体都有此错误,其类名以红色下划线。我做错了什么?

    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.1"
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 
    http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="IdpCertificateValidate">
        <class>model.Attribute</class>
        <class>model.Company</class>
        <class>model.ComplexityRule</class>
        <class>model.ComplexityRulePattern</class>
        <class>model.ComplexityRulePatternPK</class>
        <class>model.PasswordPolicy</class>
        <class>model.Role</class>
        <class>model.User</class>
        <class>model.UserAttribute</class>
        <class>model.UserAttributePK</class>
        <class>model.UserFailedLogin</class>
        <class>model.UserFailedLoginPK</class>
        <class>model.UserPasswordHistory</class>
        <class>model.UserPasswordHistoryPK</class>
    </persistence-unit>
</persistence>

1 个答案:

答案 0 :(得分:1)

好的很奇怪我添加了#34;一个&#34; @Table(name = "Attribute")标记,所有错误都消失了。然后我删除了@Table注释,错误没有返回。