In the same documentation the following is stated and this was always my definition of querying mappedSC.

Section 1.3

"A mapped superclass is a non-entity class that can define persistent state and mapping information for entity subclasses. Mapped superclasses are usually abstract. Unlike true entities, you cannot query a mapped superclass, pass a mapped superclass instance to any EntityManager or Query methods, or declare a persistent relation with a mapped superclass target. You denote a mapped superclass with the MappedSuperclass marker annotation. "

So whats correct here? The Note says the opposite... Perhaps it should be made clearer but i always thought that the note is not true, because in my code, i experienced the same as Jim.

So any feedback from the core team appreciated....

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 20.04.2009 um 21:38 schrieb jim weaver:


I have the following:

@MappedSuperclass class A { }
@Entity class B extends A { }
@Entity class C extends A { }

and I try to do this type of query: SELECT a FROM A a

I receive error message "An error occurred while parsing the query filter "SELECT a FROM A a". Error message: The name "A" is not a recognized entity or identifier. Perhaps you meant B, which is a close match. Known
entity names: [B, C]"

A is defined in my persistence.xml and my tables do have the inherited
fields from it so I'm pretty sure jpa is recognizing it.

The OpenJPA doc says that the query is supported.....this is from the 1.2.0
doc:

Note
OpenJPA allows you to query on mapped superclasses. A query on a mapped
superclass will return all matching subclass instances.


--
View this message in context: 
http://n2.nabble.com/Can%27t-query-against-a-MappedSuperclass-tp2665700p2665700.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Reply via email to