Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Query to MappedSuperclass fails

Hello,

What objects do you get back when running this query in OpenJpa? The specification does not allow you to query on non-entities using JPQL; you can try making FishStoreItem an Entity, or move the query to be on the appropriate Entity class for it to be JPA compliant.
Best Regards,
Chris

On 04/07/2010 5:21 AM, n0weak wrote:
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:

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).


Back to the top