嵌入式注释导致编译错误

时间:2013-12-19 10:19:19

标签: java eclipse jpa entity embeddable

我正在使用eclipse,我正在尝试创建一个包含地址嵌入的类。 不幸的是,这不会在eclipse中编译,我不知道为什么。 编译器说在Person.java中说“Address不被映射为可嵌入的”,并且Attribute在Address.java中的每个属性中都有无效的映射类型。

有人知道如何解决这个问题吗?

以下是代码:

人员实体:

@Entity
@Table(name = PersonDBConstants.TABLE_NAME, uniqueConstraints {
    @UniqueConstraint(columnNames = {
        PersonDBConstants.ID_DB_NAME
    })
})
public class Person extends NxGenDomain {

    protected Person() {

    }

    @NotNull
    @Column(name = PersonDBConstants.ID_DB_NAME, length = PersonDBConstants.ID_DB_LENGTH, nullable = true)
    private String id = null;

    @NotNull
    @Column(name = PersonDBConstants.TITLE_DB_NAME, length = PersonDBConstants.TITLE_DB_LENGTH, nullable = true)
    private String title = null;

    @Column(name = PersonDBConstants.NAME_DB_NAME, length = PersonDBConstants.NAME_DB_LENGTH, nullable = false)
    private String name = null;

    @NotNull
    @Column(name = PersonDBConstants.SHORTNAME_DB_NAME, length = PersonDBConstants.SHORTNAME_DB_LENGTH, nullable = true)
    private String shortName = null;

    @NotNull
    @Column(name = PersonDBConstants.INITIALS_DB_NAME, length = PersonDBConstants.INITIALS_DB_LENGTH, nullable = true)
    private String initials = null;

    @NotNull
    @Column(name = PersonDBConstants.NICKNAME_DB_NAME, length = PersonDBConstants.NICKNAME_DB_LENGTH, nullable = true)
    private String nickName = null;

    @NotNull
    @Column(name = PersonDBConstants.USERNAME_DB_NAME, length = PersonDBConstants.USERNAME_DB_LENGTH, nullable = true)
    private String username = null;

    @Column(name = PersonDBConstants.BREAKWORKFLOW_DB_NAME, nullable = false)
    private Boolean breakWorkflow = null;

    @Embedded
    private Address address = null;

    @Column(name = PersonDBConstants.MARITALSTATUS_DB_NAME, length = PersonDBConstants.MARITALSTATUS_DB_LENGTH, nullable = false)
    private String maritalStatus = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.MILITARYSITUATION_DB_NAME, referencedColumnName = MilitarySituationDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private MilitarySituation militarySituation = null;

    @NotNull
    @Temporal(TemporalType.DATE)
    @Column(name = PersonDBConstants.MILITARYSITUATIONDATE_DB_NAME, nullable = true)
    private Date militarySituationDate = null;

    @NotNull
    @Column(name = PersonDBConstants.DRIVERLICENSEID_DB_NAME, length = PersonDBConstants.DRIVERLICENSEID_DB_LENGTH, nullable = true)
    private String driverLicenseId = null;

    @NotNull
    @Column(name = PersonDBConstants.DRIVERLICENSEISSUER_DB_NAME, length = PersonDBConstants.DRIVERLICENSEISSUER_DB_LENGTH, nullable = true)
    private String driverLicenseIssuer = null;

    @NotNull
    @Column(name = PersonDBConstants.DRIVERLICENSEISSUEPLACE_DB_NAME, length = PersonDBConstants.DRIVERLICENSEISSUEPLACE_DB_LENGTH, nullable = true)
    private String driverLicenseIssuePlace = null;

    @NotNull
    @Temporal(TemporalType.DATE)
    @Column(name = PersonDBConstants.DRIVERLICENSEISSUEDATE_DB_NAME, nullable = true)
    private Date driverLicenseIssueDate = null;

    @NotNull
    @Column(name = PersonDBConstants.BLOODTYPE_DB_NAME, length = PersonDBConstants.BLOODTYPE_DB_LENGTH, nullable = true)
    private String bloodType = null;

    @NotNull
    @Column(name = PersonDBConstants.RHESUSFACTOR_DB_NAME, length = PersonDBConstants.RHESUSFACTOR_DB_LENGTH, nullable = true)
    private String rhesusFactor = null;

    @NotNull
    @Column(name = PersonDBConstants.BLOODDONORMEMBERID_DB_NAME, length = PersonDBConstants.BLOODDONORMEMBERID_DB_LENGTH, nullable = true)
    private String bloodDonorMemberId = null;

    @NotNull
    @Embedded
    private RangeDate insuranceRangeDate = null;

    @Embedded
    private IdentityInformation idInfo = null;

    @NotNull
    @Column(name = PersonDBConstants.CURRICULARADDITIONALINFO_DB_NAME, length = PersonDBConstants.CURRICULARADDITIONALINFO_DB_LENGTH, nullable = true)
    private String curricularAdditionalInfo = null;

    @NotNull
    @Embedded
    private FiscalNumber NIF = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.FISCALOFFICE_DB_NAME, referencedColumnName = FiscalOfficeDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private FiscalOffice fiscalOffice = null;

    @NotNull
    @Temporal(TemporalType.DATE)
    @Column(name = PersonDBConstants.FISCALSUBSCRIPTIONDATE_DB_NAME, nullable = true)
    private Date fiscalSubscriptionDate = null;

    @NotNull
    @Embedded
    private Address nifAddress = null;

    @NotNull
    @Column(name = PersonDBConstants.SOCIALSECURITYNUMBER_DB_NAME, length = PersonDBConstants.SOCIALSECURITYNUMBER_DB_LENGTH, nullable = true)
    private String socialSecurityNumber = null;

    @NotNull
    @Temporal(TemporalType.DATE)
    @Column(name = PersonDBConstants.SOCIALSECURITYSTARTDATE_DB_NAME, nullable = true)
    private Date socialSecurityStartDate = null;

    @NotNull
    @Column(name = PersonDBConstants.CGANUMBER_DB_NAME, length = PersonDBConstants.CGANUMBER_DB_LENGTH, nullable = true)
    private String cgaNumber = null;

    @NotNull
    @Temporal(TemporalType.DATE)
    @Column(name = PersonDBConstants.CGASTARTDATE_DB_NAME, nullable = true)
    private Date cgaStartDate = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.PRICETYPE_DB_NAME, referencedColumnName = PriceTypeDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private PriceType priceType = null;

    @NotNull
    @Column(name = PersonDBConstants.PLAFOND_DB_NAME, precision = PersonDBConstants.PLAFOND_DB_PRECISION, scale = PersonDBConstants.PLAFOND_DB_SCALE, nullable = true)
    private BigDecimal plafond = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.BUSINESSPARTNER_DB_NAME, referencedColumnName = BusinessPartnerDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private BusinessPartner businessPartner = null;

    @NotNull
    @Column(name = PersonDBConstants.USUARY_DB_NAME, length = PersonDBConstants.USUARY_DB_LENGTH, nullable = true)
    private String usuary = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.RACECOLOR_DB_NAME, referencedColumnName = RaceColorDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private RaceColor raceColor = null;

    @NotNull
    @Column(name = PersonDBConstants.WORKINGPAPERSID_DB_NAME, length = PersonDBConstants.WORKINGPAPERSID_DB_LENGTH, nullable = true)
    private String workingPapersId = null;

    @NotNull
    @Column(name = PersonDBConstants.WORKINGPAPERSSERIE_DB_NAME, length = PersonDBConstants.WORKINGPAPERSSERIE_DB_LENGTH, nullable = true)
    private String workingPapersSerie = null;

    @NotNull
    @Temporal(TemporalType.DATE)
    @Column(name = PersonDBConstants.WORKINGPAPERSDATE_DB_NAME, nullable = true)
    private Date workingPapersDate = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.WORKINGPAPERSSTATE_DB_NAME, referencedColumnName = StateDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private State workingPapersState = null;

    @NotNull
    @Column(name = PersonDBConstants.VOTERCARDID_DB_NAME, length = PersonDBConstants.VOTERCARDID_DB_LENGTH, nullable = true)
    private String voterCardId = null;

    @NotNull
    @Column(name = PersonDBConstants.VOTERCARDREGION_DB_NAME, length = PersonDBConstants.VOTERCARDREGION_DB_LENGTH, nullable = true)
    private String voterCardRegion = null;

    @NotNull
    @Column(name = PersonDBConstants.VOTERCARDSERIE_DB_NAME, length = PersonDBConstants.VOTERCARDSERIE_DB_LENGTH, nullable = true)
    private String voterCardSerie = null;

    @NotNull
    @Column(name = PersonDBConstants.VOTERCARDCITY_DB_NAME, length = PersonDBConstants.VOTERCARDCITY_DB_LENGTH, nullable = true)
    private String voterCardCity = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = PersonDBConstants.VOTERCARDSTATE_DB_NAME, referencedColumnName = StateDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private State voterCardState = null;

    @Column(name = PersonDBConstants.ISAPPLICANT_DB_NAME, nullable = false)
    private Boolean isApplicant = null;

    public String getId() {
        return this.id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return this.title;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public String getShortName() {
        return this.shortName;
    }

    public void setInitials(String initials) {
        this.initials = initials;
    }

    public String getInitials() {
        return this.initials;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getNickName() {
        return this.nickName;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUsername() {
        return this.username;
    }

    public void setBreakWorkflow(Boolean breakWorkflow) {
        this.breakWorkflow = breakWorkflow;
    }

    public Boolean getBreakWorkflow() {
        return this.breakWorkflow;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Address getAddress() {
        return this.address;
    }

    public void setMaritalStatus(String maritalStatus) {
        this.maritalStatus = maritalStatus;
    }

    public String getMaritalStatus() {
        return this.maritalStatus;
    }

    public MilitarySituation getMilitarySituation() {
        return this.militarySituation;
    }

    public Date getMilitarySituationDate() {
        return this.militarySituationDate;
    }

    public void setDriverLicenseId(String driverLicenseId) {
        this.driverLicenseId = driverLicenseId;
    }

    public String getDriverLicenseId() {
        return this.driverLicenseId;
    }

    public void setDriverLicenseIssuer(String driverLicenseIssuer) {
        this.driverLicenseIssuer = driverLicenseIssuer;
    }

    public String getDriverLicenseIssuer() {
        return this.driverLicenseIssuer;
    }

    public void setDriverLicenseIssuePlace(String driverLicenseIssuePlace) {
        this.driverLicenseIssuePlace = driverLicenseIssuePlace;
    }

    public String getDriverLicenseIssuePlace() {
        return this.driverLicenseIssuePlace;
    }

    public void setDriverLicenseIssueDate(Date driverLicenseIssueDate) {
        this.driverLicenseIssueDate = driverLicenseIssueDate;
    }

    public Date getDriverLicenseIssueDate() {
        return this.driverLicenseIssueDate;
    }

    public void setBloodType(String bloodType) {
        this.bloodType = bloodType;
    }

    public String getBloodType() {
        return this.bloodType;
    }

    public void setRhesusFactor(String rhesusFactor) {
        this.rhesusFactor = rhesusFactor;
    }

    public String getRhesusFactor() {
        return this.rhesusFactor;
    }

    public void setBloodDonorMemberId(String bloodDonorMemberId) {
        this.bloodDonorMemberId = bloodDonorMemberId;
    }

    public String getBloodDonorMemberId() {
        return this.bloodDonorMemberId;
    }

    public void setInsuranceRangeDate(RangeDate insuranceRangeDate) {
        this.insuranceRangeDate = insuranceRangeDate;
    }

    public RangeDate getInsuranceRangeDate() {
        return this.insuranceRangeDate;
    }

    public void setIdInfo(IdentityInformation idInfo) {
        this.idInfo = idInfo;
    }

    public IdentityInformation getIdInfo() {
        return this.idInfo;
    }

    public void setCurricularAdditionalInfo(String curricularAdditionalInfo) {
        this.curricularAdditionalInfo = curricularAdditionalInfo;
    }

    public String getCurricularAdditionalInfo() {
        return this.curricularAdditionalInfo;
    }

    public void setNIF(FiscalNumber NIF) {
        this.NIF = NIF;
    }

    public FiscalNumber getNIF() {
        return this.NIF;
    }

    public void setFiscalOffice(FiscalOffice fiscalOffice) {
        this.fiscalOffice = fiscalOffice;
    }

    public FiscalOffice getFiscalOffice() {
        return this.fiscalOffice;
    }

    public void setFiscalSubscriptionDate(Date fiscalSubscriptionDate) {
        this.fiscalSubscriptionDate = fiscalSubscriptionDate;
    }

    public Date getFiscalSubscriptionDate() {
        return this.fiscalSubscriptionDate;
    }

    public void setNifAddress(Address nifAddress) {
        this.nifAddress = nifAddress;
    }

    public Address getNifAddress() {
        return this.nifAddress;
    }

    public void setSocialSecurityNumber(String socialSecurityNumber) {
        this.socialSecurityNumber = socialSecurityNumber;
    }

    public String getSocialSecurityNumber() {
        return this.socialSecurityNumber;
    }

    public void setSocialSecurityStartDate(Date socialSecurityStartDate) {
        this.socialSecurityStartDate = socialSecurityStartDate;
    }

    public Date getSocialSecurityStartDate() {
        return this.socialSecurityStartDate;
    }

    public void setCgaNumber(String cgaNumber) {
        this.cgaNumber = cgaNumber;
    }

    public String getCgaNumber() {
        return this.cgaNumber;
    }

    public void setCgaStartDate(Date cgaStartDate) {
        this.cgaStartDate = cgaStartDate;
    }

    public Date getCgaStartDate() {
        return this.cgaStartDate;
    }

    public void setPriceType(PriceType priceType) {
        this.priceType = priceType;
    }

    public PriceType getPriceType() {
        return this.priceType;
    }

    public void setPlafond(BigDecimal plafond) {
        this.plafond = plafond;
    }

    public BigDecimal getPlafond() {
        return this.plafond;
    }

    public void setBusinessPartner(BusinessPartner businessPartner) {
        this.businessPartner = businessPartner;
    }

    public BusinessPartner getBusinessPartner() {
        return this.businessPartner;
    }

    public void setUsuary(String usuary) {
        this.usuary = usuary;
    }

    public String getUsuary() {
        return this.usuary;
    }

    public void setRaceColor(RaceColor raceColor) {
        this.raceColor = raceColor;
    }

    public RaceColor getRaceColor() {
        return this.raceColor;
    }

    public void setWorkingPapersId(String workingPapersId) {
        this.workingPapersId = workingPapersId;
    }

    public String getWorkingPapersId() {
        return this.workingPapersId;
    }

    public void setWorkingPapersSerie(String workingPapersSerie) {
        this.workingPapersSerie = workingPapersSerie;
    }

    public String getWorkingPapersSerie() {
        return this.workingPapersSerie;
    }

    public void setWorkingPapersDate(Date workingPapersDate) {
        this.workingPapersDate = workingPapersDate;
    }

    public Date getWorkingPapersDate() {
        return this.workingPapersDate;
    }

    public void setWorkingPapersState(State workingPapersState) {
        this.workingPapersState = workingPapersState;
    }

    public State getWorkingPapersState() {
        return this.workingPapersState;
    }

    public void setVoterCardId(String voterCardId) {
        this.voterCardId = voterCardId;
    }

    public String getVoterCardId() {
        return this.voterCardId;
    }

    public void setVoterCardRegion(String voterCardRegion) {
        this.voterCardRegion = voterCardRegion;
    }

    public String getVoterCardRegion() {
        return this.voterCardRegion;
    }

    public void setVoterCardSerie(String voterCardSerie) {
        this.voterCardSerie = voterCardSerie;
    }

    public String getVoterCardSerie() {
        return this.voterCardSerie;
    }

    public void setVoterCardCity(String voterCardCity) {
        this.voterCardCity = voterCardCity;
    }

    public String getVoterCardCity() {
        return this.voterCardCity;
    }

    public void setVoterCardState(State voterCardState) {
        this.voterCardState = voterCardState;
    }

    public State getVoterCardState() {
        return this.voterCardState;
    }

    public Boolean getIsApplicant() {
        return this.isApplicant;
    }
}

地址实体:

@Embeddable
public class Address {

    protected Address() {

    }

    @NotNull
    @Column(name = AddressDBConstants.ADDRESSEE_DB_NAME, length = AddressDBConstants.ADDRESSEE_DB_LENGTH, nullable = true)
    private String addressee = null;

    @Column(name = AddressDBConstants.LINE1_DB_NAME, length = AddressDBConstants.LINE1_DB_LENGTH, nullable = false)
    private String line1 = null;

    @NotNull
    @Column(name = AddressDBConstants.LINE2_DB_NAME, length = AddressDBConstants.LINE2_DB_LENGTH, nullable = true)
    private String line2 = null;

    @NotNull
    @Column(name = AddressDBConstants.LINE3_DB_NAME, length = AddressDBConstants.LINE3_DB_LENGTH, nullable = true)
    private String line3 = null;

    @NotNull
    @Column(name = AddressDBConstants.LINE4_DB_NAME, length = AddressDBConstants.LINE4_DB_LENGTH, nullable = true)
    private String line4 = null;

    @NotNull
    @Column(name = AddressDBConstants.LOCALE_DB_NAME, length = AddressDBConstants.LOCALE_DB_LENGTH, nullable = true)
    private String locale = null;

    @NotNull
    @Column(name = AddressDBConstants.POSTALCODE_DB_NAME, length = AddressDBConstants.POSTALCODE_DB_LENGTH, nullable = true)
    private String postalCode = null;

    @NotNull
    @Column(name = AddressDBConstants.LOCATION_DB_NAME, length = AddressDBConstants.LOCATION_DB_LENGTH, nullable = true)
    private String location = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = AddressDBConstants.COUNTRY_DB_NAME, referencedColumnName = CountryDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private Country country = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = AddressDBConstants.AREA_DB_NAME, referencedColumnName = AreaDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private Area area = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = AddressDBConstants.REGIONALCLASSIFICATION_DB_NAME, referencedColumnName = RegionalClassificationDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private RegionalClassification regionalClassification = null;

    @NotNull
    @Column(name = AddressDBConstants.CITY_DB_NAME, length = AddressDBConstants.CITY_DB_LENGTH, nullable = true)
    private String city = null;

    @NotNull
    @Embedded
    private ContactInformation contactInformation = null;

    @NotNull
    @ManyToOne
    @JoinColumn(name = AddressDBConstants.STATE_DB_NAME, referencedColumnName = StateDBConstants.OBJECTKEY_DB_NAME, nullable = true)
    private State state = null;

    public void setAddressee(String addressee) {
        this.addressee = addressee;
    }

    public String getAddressee() {
        return this.addressee;
    }

    public void setLine1(String line1) {
        this.line1 = line1;
    }

    public String getLine1() {
        return this.line1;
    }

    public void setLine2(String line2) {
        this.line2 = line2;
    }

    public String getLine2() {
        return this.line2;
    }

    public void setLine3(String line3) {
        this.line3 = line3;
    }

    public String getLine3() {
        return this.line3;
    }

    public void setLine4(String line4) {
        this.line4 = line4;
    }

    public String getLine4() {
        return this.line4;
    }

    public void setLocale(String locale) {
        this.locale = locale;
    }

    public String getLocale() {
        return this.locale;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    public String getPostalCode() {
        return this.postalCode;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getLocation() {
        return this.location;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    public Country getCountry() {
        return this.country;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public Area getArea() {
        return this.area;
    }

    public void setRegionalClassification(RegionalClassification regionalClassification) {
        this.regionalClassification = regionalClassification;
    }

    public RegionalClassification getRegionalClassification() {
        return this.regionalClassification;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCity() {
        return this.city;
    }

    public void setContactInformation(ContactInformation contactInformation) {
        this.contactInformation = contactInformation;
    }

    public ContactInformation getContactInformation() {
        return this.contactInformation;
    }

    public void setState(State state) {
        this.state = state;
    }

    public State getState() {
        return this.state;
    }
}

0 个答案:

没有答案