You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Jack Bounds <Ja...@googlemail.com> on 2015/11/26 11:13:57 UTC
Java Persistence API: @MappedSuperclass not working
Hey TomEE guys!
I have state and mapping information common to couple entity classes and
just switched to a Mapped Superclass for all of them (simply moved
everything to the super class). It worked fine before I introduced the
Mapped Superclass but now I am getting first a warning and second subsequent
errors for each of the derived entity classes. Tables are not being created
anymore. I checked the documentation several times and checked my code and
anotations as well but I am not getting it. What might be wrong ?
I am running tomee 1.7.2 plus.
Thank you in advance for any help!
classes:
@MappedSuperclass
public class TradingVenue {
@Id
private String sku;
...
}
@Entity
public class Amazon extends TradingVenue { }
runtime log:
WARNUNG: The class "de.visolutions.mis.entities.Amazon" listed in the
openjpa.MetaDataFactory configuration property could not be loaded by
LazyStopWebappClassLoader
context: /mis
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@17baae6e
; ignoring.
SCHWERWIEGEND: EjbTransactionUtil.handleSystemException: Could not
initialize class de.visolutions.mis.entities.Amazon
java.lang.NoClassDefFoundError: Could not initialize class
de.visolutions.mis.entities.Amazon
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Java-Persistence-API-MappedSuperclass-not-working-tp4676978.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Java Persistence API: @MappedSuperclass not working
Posted by Jack Bounds <Ja...@googlemail.com>.
Hey Romain and Andy!
Wow - good call and a perfect throw!
I do list the classes in persistence.xml due to the fact that I am using
multiple databases. So the setting is:
persistence.xml:
<exclude-unlisted-classes>true</exclude-unlisted-classes>
After I added the missing mapped super class TradingVenue it started working
again:
<class>de.visolutions.mis.entities.TradingVenue</class>
Whether abstract or not did not make any difference though.
Thank you very much!
Enjoy TomEE, Jack
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Java-Persistence-API-MappedSuperclass-not-working-tp4676978p4676986.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Java Persistence API: @MappedSuperclass not working
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
Did you enhance it or listed it in classes in persistence.xml?
Le 26 nov. 2015 11:29, "Jack Bounds" <Ja...@googlemail.com> a écrit :
> Hey TomEE guys!
>
> I have state and mapping information common to couple entity classes and
> just switched to a Mapped Superclass for all of them (simply moved
> everything to the super class). It worked fine before I introduced the
> Mapped Superclass but now I am getting first a warning and second
> subsequent
> errors for each of the derived entity classes. Tables are not being created
> anymore. I checked the documentation several times and checked my code and
> anotations as well but I am not getting it. What might be wrong ?
>
> I am running tomee 1.7.2 plus.
>
> Thank you in advance for any help!
>
> classes:
>
> @MappedSuperclass
> public class TradingVenue {
> @Id
> private String sku;
> ...
> }
>
> @Entity
> public class Amazon extends TradingVenue { }
>
>
> runtime log:
>
> WARNUNG: The class "de.visolutions.mis.entities.Amazon" listed in the
> openjpa.MetaDataFactory configuration property could not be loaded by
> LazyStopWebappClassLoader
> context: /mis
> delegate: false
> repositories:
> /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@17baae6e
> ; ignoring.
>
> SCHWERWIEGEND: EjbTransactionUtil.handleSystemException: Could not
> initialize class de.visolutions.mis.entities.Amazon
> java.lang.NoClassDefFoundError: Could not initialize class
> de.visolutions.mis.entities.Amazon
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Java-Persistence-API-MappedSuperclass-not-working-tp4676978.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: Java Persistence API: @MappedSuperclass not working
Posted by Andy <an...@gmx.de>.
Thanks for the feedback Jack. Glad you got the issue resolved.
Andy.
On 27/11/2015 07:51, Jack Bounds wrote:
> Hey Romain and Andy!
>
> Wow - good call and a perfect throw!
>
> I do list the classes in persistence.xml due to the fact that I am using
> multiple databases. So the setting is:
>
> persistence.xml:
> <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
> After I added the missing mapped super class TradingVenue it started working
> again:
> <class>de.visolutions.mis.entities.TradingVenue</class>
>
> Whether abstract or not did not make any difference though.
>
> Thank you very much!
>
> Enjoy TomEE, Jack
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Java-Persistence-API-MappedSuperclass-not-working-tp4676978p4676987.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
--
Andy Gumbrecht
https://twitter.com/AndyGeeDe
Re: Java Persistence API: @MappedSuperclass not working
Posted by Jack Bounds <Ja...@googlemail.com>.
Hey Romain and Andy!
Wow - good call and a perfect throw!
I do list the classes in persistence.xml due to the fact that I am using
multiple databases. So the setting is:
persistence.xml:
<exclude-unlisted-classes>true</exclude-unlisted-classes>
After I added the missing mapped super class TradingVenue it started working
again:
<class>de.visolutions.mis.entities.TradingVenue</class>
Whether abstract or not did not make any difference though.
Thank you very much!
Enjoy TomEE, Jack
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Java-Persistence-API-MappedSuperclass-not-working-tp4676978p4676987.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Java Persistence API: @MappedSuperclass not working
Posted by Andy Gumbrecht <ag...@tomitribe.com>.
Hi Jack,
First impression is, could you try making the super class abstract -
public abstract class TradingVenue {...
Also, really make sure that de.visolutions.mis.entities.Amazon is on the
classpath by checking jar or classes contents.
Let me know if that works. I f not could you please provide a simple
test project reproducing the issue?
Andy.
On 26/11/2015 11:13, Jack Bounds wrote:
> Hey TomEE guys!
>
> I have state and mapping information common to couple entity classes and
> just switched to a Mapped Superclass for all of them (simply moved
> everything to the super class). It worked fine before I introduced the
> Mapped Superclass but now I am getting first a warning and second subsequent
> errors for each of the derived entity classes. Tables are not being created
> anymore. I checked the documentation several times and checked my code and
> anotations as well but I am not getting it. What might be wrong ?
>
> I am running tomee 1.7.2 plus.
>
> Thank you in advance for any help!
>
> classes:
>
> @MappedSuperclass
> public class TradingVenue {
> @Id
> private String sku;
> ...
> }
>
> @Entity
> public class Amazon extends TradingVenue { }
>
>
> runtime log:
>
> WARNUNG: The class "de.visolutions.mis.entities.Amazon" listed in the
> openjpa.MetaDataFactory configuration property could not be loaded by
> LazyStopWebappClassLoader
> context: /mis
> delegate: false
> repositories:
> /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader@17baae6e
> ; ignoring.
>
> SCHWERWIEGEND: EjbTransactionUtil.handleSystemException: Could not
> initialize class de.visolutions.mis.entities.Amazon
> java.lang.NoClassDefFoundError: Could not initialize class
> de.visolutions.mis.entities.Amazon
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Java-Persistence-API-MappedSuperclass-not-working-tp4676978.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
>
> --
> Andy Gumbrecht
> https://twitter.com/AndyGeeDe
> http://www.tomitribe.com