Question

Hello I am wondering about the following error in Netbeans (the class is part of a ManyToMany mapping where the relationship itself has additional properties and the key is needed as the "embedded" primary key):

@Embeddable
public class MembershipKey implements IMembershipKey,Serializable {

    @ManyToOne(targetEntity=User.class)
    private IUser user;
    @ManyToOne(targetEntity=WorkPlatform.class)
    private IWorkPlatform workPlatform;

    @Override
    public IUser getUser() {
        return this.user;
    }

// some getters and setters...
}

Althogh my unit tests pass and everything seems to be ok, Netbeans shows an error where the variables user and workPlatform are red underlind (Left side: White exclamation mark in red circle) where it tells: "Basic attributes can only be of the following types: Java primitive types ... and so on"

So is it a Netbeans bug or is it possibly a real error which could lead to problems in certain situations?

Était-ce utile?

La solution

If the code compiles and the parts that are showing as errors in Netbeans are exercised (something calls them) without crashing, which it seems like they are, it's a Netbeans bug.

It happens for a variety of projects I work on with Netbeans. Sometimes cleaning and building and/or exiting Netbeans helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top