Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Re: Teneo Annotations Inheritance Mapping problem
Re: Teneo Annotations Inheritance Mapping problem [message #428629] Wed, 25 March 2009 14:45 Go to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Ercan,

Please use the EMF newsgroup for CDO and Teneo questions. I've added it
to the "to" list of the reply.


Ercan Canlier wrote:
> Hi
>
> we develop a project based on CDO,Teneo,Hibernate,EMF.For inheritance
> mapping when we use SINGLE_TABLE ,all done with success,when we try to
> use TABLE_PER_CLASS stragety for inheritance,it gives
> error:Discriminator value must be declared for union-subclasses,even
> we tried to put Discriminator value or not,it still throws
> SaxParserException and the same error.
> Also with strategy JOINED ,it gives there is no Discriminator value
> however it is already put.How can we solve this problem?is there anybody
> encountered with the same problem? it would be nice who can give us a
> suggestion,some examples,tutorials...
>
> thanks for all


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Teneo Annotations Inheritance Mapping problem [message #428636 is a reply to message #428629] Wed, 25 March 2009 16:11 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Ercan,
Can you print (part of the) mapping that gives problems here? You can get it by putting a breakpoint in the class
TeneoHibernateMappingGenerator, just after the call to: CDOHelper.getInstance().generateMapping.

Can you also post the stacktrace?

Documentation on mapping strategies and Teneo in general is available here:
http://www.elver.org

gr. Martn

Ed Merks wrote:
> Ercan,
>
> Please use the EMF newsgroup for CDO and Teneo questions. I've added it
> to the "to" list of the reply.
>
>
> Ercan Canlier wrote:
>> Hi
>>
>> we develop a project based on CDO,Teneo,Hibernate,EMF.For inheritance
>> mapping when we use SINGLE_TABLE ,all done with success,when we try to
>> use TABLE_PER_CLASS stragety for inheritance,it gives
>> error:Discriminator value must be declared for union-subclasses,even
>> we tried to put Discriminator value or not,it still throws
>> SaxParserException and the same error.
>> Also with strategy JOINED ,it gives there is no Discriminator value
>> however it is already put.How can we solve this problem?is there anybody
>> encountered with the same problem? it would be nice who can give us a
>> suggestion,some examples,tutorials...
>>
>> thanks for all


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: Teneo Annotations Inheritance Mapping problem [message #428643 is a reply to message #428636] Wed, 25 March 2009 17:45 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 198
Registered: July 2009
Senior Member
Hello,

On behalf of my colligue:

The XML is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping auto-import="false">
<class entity-name="Dummy" abstract="true" lazy="false"
discriminator-value="Dummy" table="`dummy`">
<meta attribute="eclassName">Dummy</meta>
<meta attribute="epackage">http://www.company.com/model/1.0</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
</class>
<class name="com.company.shared.model.user.impl.UserImpl"
entity-name="User" abstract="false" lazy="false"
discriminator-value="INTERNAL" table="`user`">
<meta attribute="eclassName">User</meta>
<meta attribute="epackage">http://www.company.com/model/user/1.0</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPropertyHandler ">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`type`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp ertyHandler ">
<meta attribute="syntheticVersion">true</meta>
</version>
<many-to-one name="taskInbox" entity-name="TaskFolder" cascade="all"
not-null="true" lazy="false" insert="true" update="true" unique="true">
<column not-null="true" unique="false" name="`task_folder_id`"/>
</many-to-one>
<many-to-one name="messageInbox" entity-name="MessageFolder"
cascade="all" not-null="true" lazy="false" insert="true" update="true"
unique="true">
<column not-null="true" unique="false" name="`message_folder_id`"/>
</many-to-one>
<property name="email" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`email`"/>
</property>
<property name="extension" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`extension`"/>
</property>
<property name="fax" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`fax`"/>
</property>
<property name="gender" lazy="false" not-null="false" insert="true"
update="true" unique="false">
<column not-null="false" unique="false" name="`gender`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
<param name="enumClass">com.company.shared.model.user.GenderType</param >
</type>
</property>
<property name="gsm" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`gsm`"/>
</property>
<property name="name" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`name`"/>
</property>
<property name="password" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`password`"/>
</property>
<property name="phone" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`phone`"/>
</property>
<property name="surname" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`surname`"/>
</property>
<property name="status" lazy="false" not-null="false" insert="true"
update="true" unique="false">
<column not-null="false" unique="false" name="`status`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
<param name="enumClass">com.company.shared.model.user.UserStatus</param >
</type>
</property>
<property name="title" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`title`"/>
</property>
<property name="username" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`username`"/>
</property>
</class>
<joined-subclass
name="com.company.shared.model.user.impl.InternalUserImpl"
entity-name="InternalUser" abstract="false" lazy="false" extends="User"
discriminator-value="INTERNAL" table="`internaluser`">
<meta attribute="eclassName">InternalUser</meta>
<meta attribute="epackage">http://www.company.com/model/user/1.0</meta>
<key>
<column name="`user_e_id`"/>
</key>
<many-to-one name="manager" entity-name="InternalUser" lazy="false"
foreign-key="internaluser_manager" insert="true" update="true"
not-null="false">
<column not-null="false" unique="false" name="`manager_id`"/>
</many-to-one>
<list name="employees" table="`internaluser_employees`" lazy="true">
<key update="true">
<column name="`internaluser_employees_e_id`" not-null="true"
unique="false"/>
</key>
<list-index column="`internaluser_employees_idx`"/>
<many-to-many entity-name="InternalUser" unique="true"
foreign-key="internaluser_employees">
<column name="`internaluser_e_id`" not-null="true" unique="false"/>
</many-to-many>
</list>
</joined-subclass>
</hibernate-mapping>

and the exception is:

org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addXML(Configuration.java:47 1)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:165)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:74)
at
com.company.server.application.ServerApplication.start(Serve rApplication.java:60)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 556)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
at org.eclipse.equinox.launcher.Main.run(Main.java:1284)
at org.eclipse.equinox.launcher.Main.main(Main.java:1260)
Caused by: org.xml.sax.SAXParseException: Attribute
"discriminator-value" must be declared for element type "joined-subclass".
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.addDTDDefaultAttr sAndValidate(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElemen t(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unkn own Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartEle ment(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.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown 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:46 8)
... 16 more
org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.Configuration.addXML(Configuration.java:47 1)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:165)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:74)
at
com.company.server.application.ServerApplication.start(Serve rApplication.java:60)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 556)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:511)
at org.eclipse.equinox.launcher.Main.run(Main.java:1284)
at org.eclipse.equinox.launcher.Main.main(Main.java:1260)
Caused by: org.xml.sax.SAXParseException: Attribute
"discriminator-value" must be declared for element type "joined-subclass".
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.addDTDDefaultAttr sAndValidate(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElemen t(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unkn own Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartEle ment(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.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown 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:46 8)
... 16 more


Regards,
Hasan Ceylan

Martin Taal wrote:
> Hi Ercan,
> Can you print (part of the) mapping that gives problems here? You can
> get it by putting a breakpoint in the class
> TeneoHibernateMappingGenerator, just after the call to:
> CDOHelper.getInstance().generateMapping.
>
> Can you also post the stacktrace?
>
> Documentation on mapping strategies and Teneo in general is available here:
> http://www.elver.org
>
> gr. Martn
>
> Ed Merks wrote:
>> Ercan,
>>
>> Please use the EMF newsgroup for CDO and Teneo questions. I've added
>> it to the "to" list of the reply.
>>
>>
>> Ercan Canlier wrote:
>>> Hi
>>>
>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For inheritance
>>> mapping when we use SINGLE_TABLE ,all done with success,when we try
>>> to use TABLE_PER_CLASS stragety for inheritance,it gives
>>> error:Discriminator value must be declared for union-subclasses,even
>>> we tried to put Discriminator value or not,it still throws
>>> SaxParserException and the same error.
>>> Also with strategy JOINED ,it gives there is no Discriminator value
>>> however it is already put.How can we solve this problem?is there anybody
>>> encountered with the same problem? it would be nice who can give us a
>>> suggestion,some examples,tutorials...
>>>
>>> thanks for all
>
>
Re: Teneo Annotations Inheritance Mapping problem [message #428644 is a reply to message #428636] Wed, 25 March 2009 17:48 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 198
Registered: July 2009
Senior Member
Hello again,

I should also note that although I had never had such a problem with
hibernate, I always used JPA Annotations with POJOs while using hibernate.

To me, the xml teneo has generated looks just fine. But for some reason
hibernate - dom4j - xerces stack does not like it. It is complaining
about the discriminator column while it actually is there...

Hasan

Martin Taal wrote:
> Hi Ercan,
> Can you print (part of the) mapping that gives problems here? You can
> get it by putting a breakpoint in the class
> TeneoHibernateMappingGenerator, just after the call to:
> CDOHelper.getInstance().generateMapping.
>
> Can you also post the stacktrace?
>
> Documentation on mapping strategies and Teneo in general is available here:
> http://www.elver.org
>
> gr. Martn
>
> Ed Merks wrote:
>> Ercan,
>>
>> Please use the EMF newsgroup for CDO and Teneo questions. I've added
>> it to the "to" list of the reply.
>>
>>
>> Ercan Canlier wrote:
>>> Hi
>>>
>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For inheritance
>>> mapping when we use SINGLE_TABLE ,all done with success,when we try
>>> to use TABLE_PER_CLASS stragety for inheritance,it gives
>>> error:Discriminator value must be declared for union-subclasses,even
>>> we tried to put Discriminator value or not,it still throws
>>> SaxParserException and the same error.
>>> Also with strategy JOINED ,it gives there is no Discriminator value
>>> however it is already put.How can we solve this problem?is there anybody
>>> encountered with the same problem? it would be nice who can give us a
>>> suggestion,some examples,tutorials...
>>>
>>> thanks for all
>
>
Re: Teneo Annotations Inheritance Mapping problem [message #428646 is a reply to message #428644] Wed, 25 March 2009 20:07 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hasan,
Yes there should not be a discriminator-value in case of joined-subclass. Did you annotate the model to set the
annotation value (then Teneo should ignore it)? Or was it generated automatically (which Teneo should not do here...)?

gr. Martin

Hasan Ceylan wrote:
> Hello again,
>
> I should also note that although I had never had such a problem with
> hibernate, I always used JPA Annotations with POJOs while using hibernate.
>
> To me, the xml teneo has generated looks just fine. But for some reason
> hibernate - dom4j - xerces stack does not like it. It is complaining
> about the discriminator column while it actually is there...
>
> Hasan
>
> Martin Taal wrote:
>> Hi Ercan,
>> Can you print (part of the) mapping that gives problems here? You can
>> get it by putting a breakpoint in the class
>> TeneoHibernateMappingGenerator, just after the call to:
>> CDOHelper.getInstance().generateMapping.
>>
>> Can you also post the stacktrace?
>>
>> Documentation on mapping strategies and Teneo in general is available
>> here:
>> http://www.elver.org
>>
>> gr. Martn
>>
>> Ed Merks wrote:
>>> Ercan,
>>>
>>> Please use the EMF newsgroup for CDO and Teneo questions. I've added
>>> it to the "to" list of the reply.
>>>
>>>
>>> Ercan Canlier wrote:
>>>> Hi
>>>>
>>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For
>>>> inheritance mapping when we use SINGLE_TABLE ,all done with
>>>> success,when we try to use TABLE_PER_CLASS stragety for
>>>> inheritance,it gives error:Discriminator value must be declared for
>>>> union-subclasses,even we tried to put Discriminator value or not,it
>>>> still throws SaxParserException and the same error.
>>>> Also with strategy JOINED ,it gives there is no Discriminator value
>>>> however it is already put.How can we solve this problem?is there
>>>> anybody
>>>> encountered with the same problem? it would be nice who can give us
>>>> a suggestion,some examples,tutorials...
>>>>
>>>> thanks for all
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: Teneo Annotations Inheritance Mapping problem [message #428654 is a reply to message #428646] Wed, 25 March 2009 22:23 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 198
Registered: July 2009
Senior Member
After a long night I think both us and teneo was playing badly.

Yes there should NOT be an discriminator value on a joined sub class.
However teneo does NOT ignore it either...

Should I file a bugzilla?

Hasan

Martin Taal wrote:

> Hi Hasan,
> Yes there should not be a discriminator-value in case of joined-subclass.
> Did you annotate the model to set the annotation value (then Teneo should
> ignore it)? Or was it generated automatically (which Teneo should not do
> here...)?
>
> gr. Martin
>
> Hasan Ceylan wrote:
>> Hello again,
>>
>> I should also note that although I had never had such a problem with
>> hibernate, I always used JPA Annotations with POJOs while using
>> hibernate.
>>
>> To me, the xml teneo has generated looks just fine. But for some reason
>> hibernate - dom4j - xerces stack does not like it. It is complaining
>> about the discriminator column while it actually is there...
>>
>> Hasan
>>
>> Martin Taal wrote:
>>> Hi Ercan,
>>> Can you print (part of the) mapping that gives problems here? You can
>>> get it by putting a breakpoint in the class
>>> TeneoHibernateMappingGenerator, just after the call to:
>>> CDOHelper.getInstance().generateMapping.
>>>
>>> Can you also post the stacktrace?
>>>
>>> Documentation on mapping strategies and Teneo in general is available
>>> here:
>>> http://www.elver.org
>>>
>>> gr. Martn
>>>
>>> Ed Merks wrote:
>>>> Ercan,
>>>>
>>>> Please use the EMF newsgroup for CDO and Teneo questions. I've added
>>>> it to the "to" list of the reply.
>>>>
>>>>
>>>> Ercan Canlier wrote:
>>>>> Hi
>>>>>
>>>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For
>>>>> inheritance mapping when we use SINGLE_TABLE ,all done with
>>>>> success,when we try to use TABLE_PER_CLASS stragety for
>>>>> inheritance,it gives error:Discriminator value must be declared for
>>>>> union-subclasses,even we tried to put Discriminator value or not,it
>>>>> still throws SaxParserException and the same error.
>>>>> Also with strategy JOINED ,it gives there is no Discriminator value
>>>>> however it is already put.How can we solve this problem?is there
>>>>> anybody
>>>>> encountered with the same problem? it would be nice who can give us
>>>>> a suggestion,some examples,tutorials...
>>>>>
>>>>> thanks for all
>>>
>>>
>
>
Re: Teneo Annotations Inheritance Mapping problem [message #428683 is a reply to message #428654] Thu, 26 March 2009 15:22 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hasan,
Thanks the latest build (done yesterday) solves this issue.

Regarding the inheritance mapping.

I would expect the following:
A --> class
B and C --> joined-subclass
B1 and B2 --> subclass

I don't really see where the union-class is coming from... Can you check again and if indeed wrong, file a bugzilla?

One thing however is that I am not sure that Hibernate supports this inheritance mapping (start with joined and then
have single).
I think you can start with class (SINGLE_TABLE) and then have parts of the inheritance tree mapped as joined-subclass
(actually a subclass with a join element). However, this is not supported by Teneo. If you enter a bugzilla feature
request for that then I can add that.

gr. Martin

Hasan Ceylan wrote:
> As requested:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=270095
>
> Thanks for your time Martin.
>
> Another question
> Class A: abstract, JOINED
> Class B -> Class A: abstract, SINGLE_TABLE
> Class B1 -> Class B
> Class B2 -> Class B
> Class C -> Class A
>
> Class B, B1, B2, C all generated as union class. Is this expected. I think B
> & C should be joined-sublass(es), and B1 & B2 should be union.
>
> Am I correct?
>
> Martin Taal wrote:
>
>> Hi Hasan,
>> To be sure I understand correctly: you had an annotation on the eclass and
>> Teneo did not ignore it? Correct?
>>
>> If so, can you file a bugzilla? It is easy to solve so I will probably
>> pick it up quickly.
>>
>> gr. Martin
>>
>> Hasan Ceylan wrote:
>>> After a long night I think both us and teneo was playing badly.
>>>
>>> Yes there should NOT be an discriminator value on a joined sub class.
>>> However teneo does NOT ignore it either...
>>>
>>> Should I file a bugzilla?
>>>
>>> Hasan
>>>
>>> Martin Taal wrote:
>>>
>>>> Hi Hasan,
>>>> Yes there should not be a discriminator-value in case of
>>>> joined-subclass. Did you annotate the model to set the annotation value
>>>> (then Teneo should ignore it)? Or was it generated automatically (which
>>>> Teneo should not do here...)?
>>>>
>>>> gr. Martin
>>>>
>>>> Hasan Ceylan wrote:
>>>>> Hello again,
>>>>>
>>>>> I should also note that although I had never had such a problem with
>>>>> hibernate, I always used JPA Annotations with POJOs while using
>>>>> hibernate.
>>>>>
>>>>> To me, the xml teneo has generated looks just fine. But for some reason
>>>>> hibernate - dom4j - xerces stack does not like it. It is complaining
>>>>> about the discriminator column while it actually is there...
>>>>>
>>>>> Hasan
>>>>>
>>>>> Martin Taal wrote:
>>>>>> Hi Ercan,
>>>>>> Can you print (part of the) mapping that gives problems here? You can
>>>>>> get it by putting a breakpoint in the class
>>>>>> TeneoHibernateMappingGenerator, just after the call to:
>>>>>> CDOHelper.getInstance().generateMapping.
>>>>>>
>>>>>> Can you also post the stacktrace?
>>>>>>
>>>>>> Documentation on mapping strategies and Teneo in general is available
>>>>>> here:
>>>>>> http://www.elver.org
>>>>>>
>>>>>> gr. Martn
>>>>>>
>>>>>> Ed Merks wrote:
>>>>>>> Ercan,
>>>>>>>
>>>>>>> Please use the EMF newsgroup for CDO and Teneo questions. I've added
>>>>>>> it to the "to" list of the reply.
>>>>>>>
>>>>>>>
>>>>>>> Ercan Canlier wrote:
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For
>>>>>>>> inheritance mapping when we use SINGLE_TABLE ,all done with
>>>>>>>> success,when we try to use TABLE_PER_CLASS stragety for
>>>>>>>> inheritance,it gives error:Discriminator value must be declared for
>>>>>>>> union-subclasses,even we tried to put Discriminator value or not,it
>>>>>>>> still throws SaxParserException and the same error.
>>>>>>>> Also with strategy JOINED ,it gives there is no Discriminator value
>>>>>>>> however it is already put.How can we solve this problem?is there
>>>>>>>> anybody
>>>>>>>> encountered with the same problem? it would be nice who can give us
>>>>>>>> a suggestion,some examples,tutorials...
>>>>>>>>
>>>>>>>> thanks for all
>>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: Teneo Annotations Inheritance Mapping problem [message #428724 is a reply to message #428683] Fri, 27 March 2009 17:05 Go to previous messageGo to next message
Hasan Ceylan is currently offline Hasan CeylanFriend
Messages: 198
Registered: July 2009
Senior Member
Thanks Martin...

I am pretty stacked up with work at the office.

Do you mind openning up a bugzilla and assigning it to my self for a test
case to keep a record?

Hasan

Martin Taal wrote:

> Hi Hasan,
> Thanks the latest build (done yesterday) solves this issue.
>
> Regarding the inheritance mapping.
>
> I would expect the following:
> A --> class
> B and C --> joined-subclass
> B1 and B2 --> subclass
>
> I don't really see where the union-class is coming from... Can you check
> again and if indeed wrong, file a bugzilla?
>
> One thing however is that I am not sure that Hibernate supports this
> inheritance mapping (start with joined and then have single).
> I think you can start with class (SINGLE_TABLE) and then have parts of the
> inheritance tree mapped as joined-subclass (actually a subclass with a
> join element). However, this is not supported by Teneo. If you enter a
> bugzilla feature request for that then I can add that.
>
> gr. Martin
>
> Hasan Ceylan wrote:
>> As requested:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=270095
>>
>> Thanks for your time Martin.
>>
>> Another question
>> Class A: abstract, JOINED
>> Class B -> Class A: abstract, SINGLE_TABLE
>> Class B1 -> Class B
>> Class B2 -> Class B
>> Class C -> Class A
>>
>> Class B, B1, B2, C all generated as union class. Is this expected. I
>> think B & C should be joined-sublass(es), and B1 & B2 should be union.
>>
>> Am I correct?
>>
>> Martin Taal wrote:
>>
>>> Hi Hasan,
>>> To be sure I understand correctly: you had an annotation on the eclass
>>> and Teneo did not ignore it? Correct?
>>>
>>> If so, can you file a bugzilla? It is easy to solve so I will probably
>>> pick it up quickly.
>>>
>>> gr. Martin
>>>
>>> Hasan Ceylan wrote:
>>>> After a long night I think both us and teneo was playing badly.
>>>>
>>>> Yes there should NOT be an discriminator value on a joined sub class.
>>>> However teneo does NOT ignore it either...
>>>>
>>>> Should I file a bugzilla?
>>>>
>>>> Hasan
>>>>
>>>> Martin Taal wrote:
>>>>
>>>>> Hi Hasan,
>>>>> Yes there should not be a discriminator-value in case of
>>>>> joined-subclass. Did you annotate the model to set the annotation
>>>>> value (then Teneo should ignore it)? Or was it generated automatically
>>>>> (which Teneo should not do here...)?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Hasan Ceylan wrote:
>>>>>> Hello again,
>>>>>>
>>>>>> I should also note that although I had never had such a problem with
>>>>>> hibernate, I always used JPA Annotations with POJOs while using
>>>>>> hibernate.
>>>>>>
>>>>>> To me, the xml teneo has generated looks just fine. But for some
>>>>>> reason hibernate - dom4j - xerces stack does not like it. It is
>>>>>> complaining about the discriminator column while it actually is
>>>>>> there...
>>>>>>
>>>>>> Hasan
>>>>>>
>>>>>> Martin Taal wrote:
>>>>>>> Hi Ercan,
>>>>>>> Can you print (part of the) mapping that gives problems here? You
>>>>>>> can get it by putting a breakpoint in the class
>>>>>>> TeneoHibernateMappingGenerator, just after the call to:
>>>>>>> CDOHelper.getInstance().generateMapping.
>>>>>>>
>>>>>>> Can you also post the stacktrace?
>>>>>>>
>>>>>>> Documentation on mapping strategies and Teneo in general is
>>>>>>> available here:
>>>>>>> http://www.elver.org
>>>>>>>
>>>>>>> gr. Martn
>>>>>>>
>>>>>>> Ed Merks wrote:
>>>>>>>> Ercan,
>>>>>>>>
>>>>>>>> Please use the EMF newsgroup for CDO and Teneo questions. I've
>>>>>>>> added it to the "to" list of the reply.
>>>>>>>>
>>>>>>>>
>>>>>>>> Ercan Canlier wrote:
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For
>>>>>>>>> inheritance mapping when we use SINGLE_TABLE ,all done with
>>>>>>>>> success,when we try to use TABLE_PER_CLASS stragety for
>>>>>>>>> inheritance,it gives error:Discriminator value must be declared
>>>>>>>>> for union-subclasses,even we tried to put Discriminator value or
>>>>>>>>> not,it still throws SaxParserException and the same error.
>>>>>>>>> Also with strategy JOINED ,it gives there is no Discriminator
>>>>>>>>> value however it is already put.How can we solve this problem?is
>>>>>>>>> there anybody
>>>>>>>>> encountered with the same problem? it would be nice who can give
>>>>>>>>> us a suggestion,some examples,tutorials...
>>>>>>>>>
>>>>>>>>> thanks for all
>>>>
>>>
>>
>>
>
>
Re: Teneo Annotations Inheritance Mapping problem [message #428755 is a reply to message #428724] Sun, 29 March 2009 12:53 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hasan,
Okay here it is:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=270384

gr. Martin

Hasan Ceylan wrote:
> Thanks Martin...
>
> I am pretty stacked up with work at the office.
>
> Do you mind openning up a bugzilla and assigning it to my self for a test
> case to keep a record?
>
> Hasan
>
> Martin Taal wrote:
>
>> Hi Hasan,
>> Thanks the latest build (done yesterday) solves this issue.
>>
>> Regarding the inheritance mapping.
>>
>> I would expect the following:
>> A --> class
>> B and C --> joined-subclass
>> B1 and B2 --> subclass
>>
>> I don't really see where the union-class is coming from... Can you check
>> again and if indeed wrong, file a bugzilla?
>>
>> One thing however is that I am not sure that Hibernate supports this
>> inheritance mapping (start with joined and then have single).
>> I think you can start with class (SINGLE_TABLE) and then have parts of the
>> inheritance tree mapped as joined-subclass (actually a subclass with a
>> join element). However, this is not supported by Teneo. If you enter a
>> bugzilla feature request for that then I can add that.
>>
>> gr. Martin
>>
>> Hasan Ceylan wrote:
>>> As requested:
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=270095
>>>
>>> Thanks for your time Martin.
>>>
>>> Another question
>>> Class A: abstract, JOINED
>>> Class B -> Class A: abstract, SINGLE_TABLE
>>> Class B1 -> Class B
>>> Class B2 -> Class B
>>> Class C -> Class A
>>>
>>> Class B, B1, B2, C all generated as union class. Is this expected. I
>>> think B & C should be joined-sublass(es), and B1 & B2 should be union.
>>>
>>> Am I correct?
>>>
>>> Martin Taal wrote:
>>>
>>>> Hi Hasan,
>>>> To be sure I understand correctly: you had an annotation on the eclass
>>>> and Teneo did not ignore it? Correct?
>>>>
>>>> If so, can you file a bugzilla? It is easy to solve so I will probably
>>>> pick it up quickly.
>>>>
>>>> gr. Martin
>>>>
>>>> Hasan Ceylan wrote:
>>>>> After a long night I think both us and teneo was playing badly.
>>>>>
>>>>> Yes there should NOT be an discriminator value on a joined sub class.
>>>>> However teneo does NOT ignore it either...
>>>>>
>>>>> Should I file a bugzilla?
>>>>>
>>>>> Hasan
>>>>>
>>>>> Martin Taal wrote:
>>>>>
>>>>>> Hi Hasan,
>>>>>> Yes there should not be a discriminator-value in case of
>>>>>> joined-subclass. Did you annotate the model to set the annotation
>>>>>> value (then Teneo should ignore it)? Or was it generated automatically
>>>>>> (which Teneo should not do here...)?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Hasan Ceylan wrote:
>>>>>>> Hello again,
>>>>>>>
>>>>>>> I should also note that although I had never had such a problem with
>>>>>>> hibernate, I always used JPA Annotations with POJOs while using
>>>>>>> hibernate.
>>>>>>>
>>>>>>> To me, the xml teneo has generated looks just fine. But for some
>>>>>>> reason hibernate - dom4j - xerces stack does not like it. It is
>>>>>>> complaining about the discriminator column while it actually is
>>>>>>> there...
>>>>>>>
>>>>>>> Hasan
>>>>>>>
>>>>>>> Martin Taal wrote:
>>>>>>>> Hi Ercan,
>>>>>>>> Can you print (part of the) mapping that gives problems here? You
>>>>>>>> can get it by putting a breakpoint in the class
>>>>>>>> TeneoHibernateMappingGenerator, just after the call to:
>>>>>>>> CDOHelper.getInstance().generateMapping.
>>>>>>>>
>>>>>>>> Can you also post the stacktrace?
>>>>>>>>
>>>>>>>> Documentation on mapping strategies and Teneo in general is
>>>>>>>> available here:
>>>>>>>> http://www.elver.org
>>>>>>>>
>>>>>>>> gr. Martn
>>>>>>>>
>>>>>>>> Ed Merks wrote:
>>>>>>>>> Ercan,
>>>>>>>>>
>>>>>>>>> Please use the EMF newsgroup for CDO and Teneo questions. I've
>>>>>>>>> added it to the "to" list of the reply.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Ercan Canlier wrote:
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> we develop a project based on CDO,Teneo,Hibernate,EMF.For
>>>>>>>>>> inheritance mapping when we use SINGLE_TABLE ,all done with
>>>>>>>>>> success,when we try to use TABLE_PER_CLASS stragety for
>>>>>>>>>> inheritance,it gives error:Discriminator value must be declared
>>>>>>>>>> for union-subclasses,even we tried to put Discriminator value or
>>>>>>>>>> not,it still throws SaxParserException and the same error.
>>>>>>>>>> Also with strategy JOINED ,it gives there is no Discriminator
>>>>>>>>>> value however it is already put.How can we solve this problem?is
>>>>>>>>>> there anybody
>>>>>>>>>> encountered with the same problem? it would be nice who can give
>>>>>>>>>> us a suggestion,some examples,tutorials...
>>>>>>>>>>
>>>>>>>>>> thanks for all
>>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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
Previous Topic:[CDO] M6 and ClassCastException + missing setLazyPackageRegistry() method
Next Topic:[CDO] setup-workspace.prop update for M6
Goto Forum:
  


Current Time: Thu Apr 25 18:01:46 GMT 2024

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

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

Back to the top