Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » MappedSuperClass
MappedSuperClass [message #82989] Thu, 10 May 2007 13:55 Go to next message
Eclipse UserFriend
Originally posted by: cn.arcsolutions.de

Hello,

My hierarchy is simplified like this:
Class A
Subclass B(from A)
Subclass C (from B)
Subclass D (from B)

My Question is: can I map class B with TABLE_PER_CLASS? I've tried it with the teneo annotation and get an exception, that the column e_id (normally saved under class A) is unknown (to C, I think).

By the way: I try this break of hierarchy to speedup my db-model. Is an performance increase possible?

thanks

cn
Re: MappedSuperClass [message #83005 is a reply to message #82989] Thu, 10 May 2007 14:01 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Have you tried to set @MappedSuperClass on A, or have you set the inheritancestrategy on B? The last
is only possible if A is transient or a mappedsuperclass.

gr. Martin

Christian Neudert wrote:
> Hello,
>
> My hierarchy is simplified like this:
> Class A Subclass B(from A) Subclass C (from B)
> Subclass D (from B)
>
> My Question is: can I map class B with TABLE_PER_CLASS? I've tried it
> with the teneo annotation and get an exception, that the column e_id
> (normally saved under class A) is unknown (to C, I think).
>
> By the way: I try this break of hierarchy to speedup my db-model. Is an
> performance increase possible?
>
> thanks
>
> cn


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #83020 is a reply to message #83005] Thu, 10 May 2007 14:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cn.arcsolutions.de

Sorry my mistake. I would like to map class C with TABLE_PER_CLASS.
I've tested it with @MappedSuperclass on B but then I get an SAXParserExcpetion instead.
Re: MappedSuperClass [message #83034 is a reply to message #83020] Thu, 10 May 2007 14:42 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
What does the exception say?
and how does your annotation look like?
Probably you also need to @MappedSuperclass on A.

gr. Martin

Christian Neudert wrote:
> Sorry my mistake. I would like to map class C with TABLE_PER_CLASS.
> I've tested it with @MappedSuperclass on B but then I get an
> SAXParserExcpetion instead.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #83050 is a reply to message #83034] Thu, 10 May 2007 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cn.arcsolutions.de

My annotation is just @MappedSuperclass on B and @Inheritance(strategy=TABLE_PER_CLASS) on C and D.
well I can't set the annotation to A because it is referenced by other classes (B isn't).

Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match " (meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id |composite-id),discriminator?,natural-id?,(version|timestamp )?,(property|many-to-one|one-to-one|component|dynamic-compon ent|properties|any|map|set|list|bag|idbag|array|primitive-ar ray)*,((join*,subclass*)|joined-subclass*|union-subclass*),l oader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset *,(query|sql-query)*) ".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExc eption(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement( Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknow n Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndEleme nt(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.dom4j.io.SAXReader.read(SAXReader.java:365)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:43 6)
.... 61 more
Re: MappedSuperClass [message #83064 is a reply to message #83050] Thu, 10 May 2007 15:12 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
In general Hibernate does not allow mixing different inheritance approaches in one inheritance
structure. You can put table-per-class on A though.
Teneo only supports the inheritancestrategy on the root of the inheritance structure (ignoring
mappedsuperclass and transient types).

gr. Martin

Christian Neudert wrote:
> My annotation is just @MappedSuperclass on B and
> @Inheritance(strategy=TABLE_PER_CLASS) on C and D.
> well I can't set the annotation to A because it is referenced by other
> classes (B isn't).
>
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "class" must match
> " (meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id |composite-id),discriminator?,natural-id?,(version|timestamp )?,(property|many-to-one|one-to-one|component|dynamic-compon ent|properties|any|map|set|list|bag|idbag|array|primitive-ar ray)*,((join*,subclass*)|joined-subclass*|union-subclass*),l oader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset *,(query|sql-query)*) ".
>
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExc eption(Unknown
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement( Unknown
> Source)
> at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknow n Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndEleme nt(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.dom4j.io.SAXReader.read(SAXReader.java:465)
> at org.dom4j.io.SAXReader.read(SAXReader.java:365)
> at org.hibernate.cfg.Configuration.addXML(Configuration.java:43 6)
> .... 61 more
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #83079 is a reply to message #83050] Thu, 10 May 2007 15:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cn.arcsolutions.de

Thanks for the quick response!

So i got to live with it. By the way, would there be a performance increasement if I could "cut of" A completely? Now from A to C all classes are joined.
I think this should cut the db-select by one table and make it faster!

cn
Re: MappedSuperClass [message #83094 is a reply to message #83079] Thu, 10 May 2007 15:30 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
It all depends...
Just for my curiosity how many records will there be in A, B and C and how often are you reading them?

gr. Martin

Christian Neudert wrote:
> Thanks for the quick response!
>
> So i got to live with it. By the way, would there be a performance
> increasement if I could "cut of" A completely? Now from A to C all
> classes are joined.
> I think this should cut the db-select by one table and make it faster!
>
> cn


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #83114 is a reply to message #83094] Thu, 10 May 2007 15:48 Go to previous message
Eclipse UserFriend
Originally posted by: cn.arcsolutions.de

Hi,

Well as you said, "It all depends" how many parts are loaded to db.
Nearly all my classes are sublasses of A so at the moment i think normal values are:
for A around 100000
for B around 90000
for C around 10000

Normal UseCase: read one time (but only around 2%).

bye

Christian


Martin Taal schrieb:
> Hi Christian,
> It all depends...
> Just for my curiosity how many records will there be in A, B and C and
> how often are you reading them?
Re: MappedSuperClass [message #606663 is a reply to message #82989] Thu, 10 May 2007 14:01 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Have you tried to set @MappedSuperClass on A, or have you set the inheritancestrategy on B? The last
is only possible if A is transient or a mappedsuperclass.

gr. Martin

Christian Neudert wrote:
> Hello,
>
> My hierarchy is simplified like this:
> Class A Subclass B(from A) Subclass C (from B)
> Subclass D (from B)
>
> My Question is: can I map class B with TABLE_PER_CLASS? I've tried it
> with the teneo annotation and get an exception, that the column e_id
> (normally saved under class A) is unknown (to C, I think).
>
> By the way: I try this break of hierarchy to speedup my db-model. Is an
> performance increase possible?
>
> thanks
>
> cn


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #606664 is a reply to message #83005] Thu, 10 May 2007 14:28 Go to previous message
Christian Neudert is currently offline Christian NeudertFriend
Messages: 13
Registered: July 2009
Junior Member
Sorry my mistake. I would like to map class C with TABLE_PER_CLASS.
I've tested it with @MappedSuperclass on B but then I get an SAXParserExcpetion instead.
Re: MappedSuperClass [message #606665 is a reply to message #83020] Thu, 10 May 2007 14:42 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
What does the exception say?
and how does your annotation look like?
Probably you also need to @MappedSuperclass on A.

gr. Martin

Christian Neudert wrote:
> Sorry my mistake. I would like to map class C with TABLE_PER_CLASS.
> I've tested it with @MappedSuperclass on B but then I get an
> SAXParserExcpetion instead.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #606666 is a reply to message #83034] Thu, 10 May 2007 15:01 Go to previous message
Christian Neudert is currently offline Christian NeudertFriend
Messages: 13
Registered: July 2009
Junior Member
My annotation is just @MappedSuperclass on B and @Inheritance(strategy=TABLE_PER_CLASS) on C and D.
well I can't set the annotation to A because it is referenced by other classes (B isn't).

Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match " (meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id |composite-id),discriminator?,natural-id?,(version|timestamp )?,(property|many-to-one|one-to-one|component|dynamic-compon ent|properties|any|map|set|list|bag|idbag|array|primitive-ar ray)*,((join*,subclass*)|joined-subclass*|union-subclass*),l oader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset *,(query|sql-query)*) ".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExc eption(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement( Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknow n Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndEleme nt(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.dom4j.io.SAXReader.read(SAXReader.java:365)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:43 6)
.... 61 more
Re: MappedSuperClass [message #606667 is a reply to message #83050] Thu, 10 May 2007 15:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
In general Hibernate does not allow mixing different inheritance approaches in one inheritance
structure. You can put table-per-class on A though.
Teneo only supports the inheritancestrategy on the root of the inheritance structure (ignoring
mappedsuperclass and transient types).

gr. Martin

Christian Neudert wrote:
> My annotation is just @MappedSuperclass on B and
> @Inheritance(strategy=TABLE_PER_CLASS) on C and D.
> well I can't set the annotation to A because it is referenced by other
> classes (B isn't).
>
> Caused by: org.xml.sax.SAXParseException: The content of element type
> "class" must match
> " (meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id |composite-id),discriminator?,natural-id?,(version|timestamp )?,(property|many-to-one|one-to-one|component|dynamic-compon ent|properties|any|map|set|list|bag|idbag|array|primitive-ar ray)*,((join*,subclass*)|joined-subclass*|union-subclass*),l oader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset *,(query|sql-query)*) ".
>
> at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExc eption(Unknown
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement( Unknown
> Source)
> at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknow n Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndEleme nt(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at org.dom4j.io.SAXReader.read(SAXReader.java:465)
> at org.dom4j.io.SAXReader.read(SAXReader.java:365)
> at org.hibernate.cfg.Configuration.addXML(Configuration.java:43 6)
> .... 61 more
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #606668 is a reply to message #83050] Thu, 10 May 2007 15:22 Go to previous message
Christian Neudert is currently offline Christian NeudertFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks for the quick response!

So i got to live with it. By the way, would there be a performance increasement if I could "cut of" A completely? Now from A to C all classes are joined.
I think this should cut the db-select by one table and make it faster!

cn
Re: MappedSuperClass [message #606669 is a reply to message #83079] Thu, 10 May 2007 15:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Christian,
It all depends...
Just for my curiosity how many records will there be in A, B and C and how often are you reading them?

gr. Martin

Christian Neudert wrote:
> Thanks for the quick response!
>
> So i got to live with it. By the way, would there be a performance
> increasement if I could "cut of" A completely? Now from A to C all
> classes are joined.
> I think this should cut the db-select by one table and make it faster!
>
> cn


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: MappedSuperClass [message #606670 is a reply to message #83094] Thu, 10 May 2007 15:48 Go to previous message
Christian Neudert is currently offline Christian NeudertFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

Well as you said, "It all depends" how many parts are loaded to db.
Nearly all my classes are sublasses of A so at the moment i think normal values are:
for A around 100000
for B around 90000
for C around 10000

Normal UseCase: read one time (but only around 2%).

bye

Christian


Martin Taal schrieb:
> Hi Christian,
> It all depends...
> Just for my curiosity how many records will there be in A, B and C and
> how often are you reading them?
Previous Topic:MappedSuperClass
Next Topic:EMFT examples and eclipse 3.2.2
Goto Forum:
  


Current Time: Thu Jan 28 05:57:31 GMT 2021

Powered by FUDForum. Page generated in 0.02987 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top