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:
@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 {
......
}
Problem is in the following exception:
Quote: |
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].
|
Same code works fine with Apache OpenJpa 2.0.0, but fails with EclipseLink ver 2.0.0, 2.0.1, 1.0 (I have not tested it with other versions).
Upd: Solution
As I was answered here, there is no chance to make it work with EclipseLink. So I solved the problem simply by switching to @Inheritance(strategy=InheritanceType.JOINED).
[Updated on: Mon, 05 July 2010 05:36] by Moderator