users@glassfish.java.net

ElipseLink: Query to MappedSuperclass fails

From: <glassfish_at_javadesktop.org>
Date: Sun, 04 Jul 2010 03:31:04 PDT

My application is a store selling fishes, aquariums etc. I want to get a list of top 10 items among all the items based on sales count. I use the following class:
[i]
@MappedSuperclass
@NamedQueries({
        @NamedQuery(name="getTopItems",query="SELECT x FROM FishStoreItem x ORDER BY x.salescnt DESC, x.title DESC")
})
public abstract class FishStoreItem extends DomainSuperClass implements Serializable {
......
}[/i]

Problem is in the following exception:

[b]Exception [EclipseLink-8034] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [getTopItems: SELECT x FROM FishStoreItem x ORDER BY x.salescnt DESC, x.title DESC]. Unknown entity type [FishStoreItem].[/b]

Same code works fine with Apache OpenJpa 2.0.0, but fails with EclipseLink ver 2.0.0, 2.1.0, 1.0 (I have not tested it with other versions).
[Message sent by forum member 'n0weak']

http://forums.java.net/jive/thread.jspa?messageID=476745