The spec defines the following limitations of a MappedSuperclass:

2.1.9.2 Mapped Superclasses
...
A mapped superclass, unlike an entity, is not queryable and cannot be passed as an argument to EntityManager or Query operations. A mapped superclass cannot be the target of a persistent relationship.

-marina

tbee wrote:


tbee wrote:



Jacek Laskowski-4 wrote:

So I read it that you're relying "on the other mechanisms" TopLink JPA
provides.


Ah, no, all classes are defined in the persistence.xml. In fact I turned
autodetection explicitely off when I was trying Hibernate (OpenJPA is
attempt 3); my persistent classes are reverse engineered from the DB and
some metatables generate classes that cause trouble, and I explicitely
make them non-persistent by removing them from the <class> list. Sorry.



Is it possible this has to do with the way I've setup the entity classes?
What I do is have an @Entity class without any fields and it extends a
@MappedSuperclass which is generated from the DB and where all the actual
fields are declared.

package nl.reinders.bm;
@Entity
@Table(name="article")
public class Article extends nl.reinders.bm.generated.Article
{
        ... almost empty...
}


package nl.reinders.bm.generated;
@MappedSuperclass
public class Article
{
        @OneToMany(mappedBy = "iArticle"...
        ...
        @Column(name="description")
        private String iDescription;
        ....
}


Reply via email to