Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Embeddable annotation?
[Teneo] Embeddable annotation? [message #72570] Thu, 22 February 2007 18:07 Go to next message
Brian Vetter is currently offline Brian VetterFriend
Messages: 74
Registered: July 2009
Member
I have a type that I always want to embed in the including type. While I can use the @Embedded annotation on each element of that type, I'd like to set it for all elements that included it without having to annotate each element. I was presuming that this was the idea behind the @Embeddable class annotation.

However, when I use @Embeddable in the type, I get the following exception when generating the mappings:

Exception in thread "main" org.hibernate.MappingException: An association from the table ziptypes_memory refers to an unmapped class: basictypes.SizeType
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys (Configuration.java:1252)
at org.hibernate.cfg.Configuration.secondPassCompile(Configurat ion.java:1170)
at org.hibernate.cfg.Configuration.buildMappings(Configuration. java:1115)
at org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:174)
at org.ziptie.persist.TestXSD.createDataStore(TestXSD.java:114)

The XSD fragment that I'm trying to make embeddable is the following:

<complexType name="SizeType">
<annotation>
<appinfo source="teneo.jpa">@Embeddable</appinfo>
</annotation>
<simpleContent>
<extension base="long">
<attribute name="unit" use="required">
<simpleType>
<restriction base="string">
<enumeration value="B"></enumeration>
<enumeration value="KB"></enumeration>
<enumeration value="MB"></enumeration>
<enumeration value="GB"></enumeration>
</restriction>
</simpleType>
</attribute>
</extension>
</simpleContent>
</complexType>

Is there something I'm doing wrong or did I misunderstand the meaning of the Embeddable annotation? Do I have to place @Embedded annotations in the including elements even if the @Embeddable annotations are in place. The documentation I've read on a variety of sites make this a bit unclear.

Based upon what I'm seeing, the @Embeddable tag simply tells Teneo to not generate a table mapping. You still have to use @Embedded in any elements that use it in order to avoid a mapping error. Failure to do so results in the above error.

BTW, I'm operating off the R0_7_maintenance branch (up to date with the CVS repository).

Brian
Re: [Teneo] Embeddable annotation? [message #72786 is a reply to message #72570] Sun, 25 February 2007 15:10 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Brian,
Yes also to me the embeddable annotation seems not that usefull...
What you can do is create a separate EDataType for this embedded type and annotate the EDataType
with the Embedded annotation. This allows you to specify the annotation in only one location.
If you also use the type in a non-embedded mode then the @Embeddable annotation should be skipped.

gr. Martin

Brian Vetter wrote:
> I have a type that I always want to embed in the including type. While I
> can use the @Embedded annotation on each element of that type, I'd like
> to set it for all elements that included it without having to annotate
> each element. I was presuming that this was the idea behind the
> @Embeddable class annotation.
>
> However, when I use @Embeddable in the type, I get the following
> exception when generating the mappings:
>
> Exception in thread "main" org.hibernate.MappingException: An
> association from the table ziptypes_memory refers to an unmapped class:
> basictypes.SizeType
> at
> org.hibernate.cfg.Configuration.secondPassCompileForeignKeys (Configuration.java:1252)
>
> at
> org.hibernate.cfg.Configuration.secondPassCompile(Configurat ion.java:1170)
> at
> org.hibernate.cfg.Configuration.buildMappings(Configuration. java:1115)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:174)
>
> at org.ziptie.persist.TestXSD.createDataStore(TestXSD.java:114)
>
> The XSD fragment that I'm trying to make embeddable is the following:
>
> <complexType name="SizeType">
> <annotation>
> <appinfo source="teneo.jpa">@Embeddable</appinfo>
> </annotation>
> <simpleContent>
> <extension base="long">
> <attribute name="unit" use="required">
> <simpleType>
> <restriction base="string">
> <enumeration value="B"></enumeration>
> <enumeration value="KB"></enumeration>
> <enumeration value="MB"></enumeration>
> <enumeration value="GB"></enumeration>
> </restriction>
> </simpleType>
> </attribute>
> </extension>
> </simpleContent>
> </complexType>
>
> Is there something I'm doing wrong or did I misunderstand the meaning of
> the Embeddable annotation? Do I have to place @Embedded annotations in
> the including elements even if the @Embeddable annotations are in place.
> The documentation I've read on a variety of sites make this a bit unclear.
>
> Based upon what I'm seeing, the @Embeddable tag simply tells Teneo to
> not generate a table mapping. You still have to use @Embedded in any
> elements that use it in order to avoid a mapping error. Failure to do so
> results in the above error.
>
> BTW, I'm operating off the R0_7_maintenance branch (up to date with the
> CVS repository).
>
> Brian


--

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: [Teneo] Embeddable annotation? [message #602935 is a reply to message #72570] Sun, 25 February 2007 15:10 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Brian,
Yes also to me the embeddable annotation seems not that usefull...
What you can do is create a separate EDataType for this embedded type and annotate the EDataType
with the Embedded annotation. This allows you to specify the annotation in only one location.
If you also use the type in a non-embedded mode then the @Embeddable annotation should be skipped.

gr. Martin

Brian Vetter wrote:
> I have a type that I always want to embed in the including type. While I
> can use the @Embedded annotation on each element of that type, I'd like
> to set it for all elements that included it without having to annotate
> each element. I was presuming that this was the idea behind the
> @Embeddable class annotation.
>
> However, when I use @Embeddable in the type, I get the following
> exception when generating the mappings:
>
> Exception in thread "main" org.hibernate.MappingException: An
> association from the table ziptypes_memory refers to an unmapped class:
> basictypes.SizeType
> at
> org.hibernate.cfg.Configuration.secondPassCompileForeignKeys (Configuration.java:1252)
>
> at
> org.hibernate.cfg.Configuration.secondPassCompile(Configurat ion.java:1170)
> at
> org.hibernate.cfg.Configuration.buildMappings(Configuration. java:1115)
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:174)
>
> at org.ziptie.persist.TestXSD.createDataStore(TestXSD.java:114)
>
> The XSD fragment that I'm trying to make embeddable is the following:
>
> <complexType name="SizeType">
> <annotation>
> <appinfo source="teneo.jpa">@Embeddable</appinfo>
> </annotation>
> <simpleContent>
> <extension base="long">
> <attribute name="unit" use="required">
> <simpleType>
> <restriction base="string">
> <enumeration value="B"></enumeration>
> <enumeration value="KB"></enumeration>
> <enumeration value="MB"></enumeration>
> <enumeration value="GB"></enumeration>
> </restriction>
> </simpleType>
> </attribute>
> </extension>
> </simpleContent>
> </complexType>
>
> Is there something I'm doing wrong or did I misunderstand the meaning of
> the Embeddable annotation? Do I have to place @Embedded annotations in
> the including elements even if the @Embeddable annotations are in place.
> The documentation I've read on a variety of sites make this a bit unclear.
>
> Based upon what I'm seeing, the @Embeddable tag simply tells Teneo to
> not generate a table mapping. You still have to use @Embedded in any
> elements that use it in order to avoid a mapping error. Failure to do so
> results in the above error.
>
> BTW, I'm operating off the R0_7_maintenance branch (up to date with the
> CVS repository).
>
> Brian


--

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
Previous Topic:[Teneo] Can't seem to access objects in store
Next Topic:[Teneo] Possible to Override Generation of hibernate.hbm.xml?
Goto Forum:
  


Current Time: Mon Oct 26 07:40:52 GMT 2020

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

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

Back to the top