views:

44

answers:

1

I've activated the auto-detect mode of Eclipselink 2.0 to find @Entity annotated classes:

<exclude-unlisted-classes>false</exclude-unlisted-classes>

But Eclipselink tells me that I should add an ID to my Entity:

Caused by: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity class [class com.example.domain.Image] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.

The example class:

import java.util.HashSet;
import java.util.Set;

//@Entity No annotation!
public class Image extends File {

    private int width;
    private int height;
    private Set<Image> variants = new HashSet<Image>();

}

How can I tell Eclipselink that not @Entity annotated classes are no entities?

A: 

The source of the problem was a compiled class which had an @Entity annotation before. The compiled class file still had this annotation and therefore Eclipselink considered it to be an entity. After running maven clean everything works as expected.

deamon