openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jasmin Riemer" <Naomi-...@gmx.de>
Subject Re: Inheritance: Subclasses are not recognised
Date Fri, 15 May 2009 14:47:31 GMT
Hi Mike,

yes, I have.
This was also my first thought about that problem ;)
Maybe other configurations in persistence.xml that may cause problems?

<properties>		
			<property name="openjpa.ConnectionUserName" value="root"/>
			<property name="openjpa.ConnectionPassword" value=""/>
			<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/ghostbase"/>
			<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
			<property name="openjpa.jdbc.DBDictionary" value="mysql(TableType=myisam)"/>
			<property name="openjpa.MaxFetchDepth" value="2"/>
		</properties>

-Jasmin

-------- Original-Nachricht --------
> Datum: Fri, 15 May 2009 09:25:54 -0500
> Von: Michael Dick <michael.d.dick@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Inheritance: Subclasses are not recognised

> Hi Jasmin,
> 
> Do you have all your entities listed in persistence.xml?
> 
> -mike
> 
> On Fri, May 15, 2009 at 7:08 AM, Jasmin Riemer <Jasmin.Riemer@gmx.de>
> wrote:
> 
> > Hello everybody,
> >
> > currently, I am working with OpenJPA in the Spring framework and try to
> > implement the following:
> >
> > I inherit certain subclasses from a mainclass. All these classes should
> be
> > mapped to a single table, so I use InheritanceType.SINGLE_TABLE and add
> a
> > discriminator value to each subclass.
> >
> > Simplified, it looks like this:
> >
> > @Entity
> > @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
> > @DiscriminatorColumn(name="doc_type",
> > discriminatorType=DiscriminatorType.STRING)
> > public abstract class Document {
> >
> > // ...
> >
> > }
> >
> > @Entity
> > @DiscriminatorValue(value="Magazine")
> > public class Magazine extends Document {
> >
> > // ...
> >
> > }
> >
> > @Entity
> > @DiscriminatorValue(value="Book")
> > public class Book extends Document {
> >
> > // ...
> >
> > }
> >
> > Unfortunately, I get the following error message when I try to load data
> > from the database:
> >
> > Exception in thread "main"
> > org.springframework.dao.InvalidDataAccessApiUsageE xception: Could not
> map
> > discriminator value "Book" to any known subclasses of the requested
> class
> > "project.entities.Document" (known discriminator values: [Document,
> > Magazine]).; nested exception is <openjpa-1.2.1-r752877:753278 nonfatal
> user
> > error> org.apache.openjpa.persistence.ArgumentException: Could not map
> > discriminator value "Book" to any known subclasses of the requested
> class
> > "project.entities.Document" (known discriminator values: [Document,
> > Magazine]).
> >
> > It seems that there are only known the main class and the subclass
> > "Magazine", but there is a problem with "Book" (and some other classes
> > inherited from "Document").
> >
> > I do not have much experience with OpenJPA and Spring and thus I have no
> > clue how to solve this problem. Anybody out there who has an idea or
> maybe
> > had a similar problem?
> > Is there maybe something special I could have used accidentally for
> > "Magazine", but not for the other classes?
> > --
> > Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> > Telefonanschluss für nur 17,95 Euro/mtl.!*
> > http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> >

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95
Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Mime
View raw message