Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] JpoxStoreException initializing dataStore when object uses Enumerator
[Teneo] JpoxStoreException initializing dataStore when object uses Enumerator [message #425250] Thu, 20 November 2008 21:14 Go to next message
Greg Kirby is currently offline Greg KirbyFriend
Messages: 6
Registered: July 2009
Junior Member
I am getting the following exception when I attempt to initialize a
jpoxDataStore for the first time:
org.eclipse.emf.teneo.jpox.JpoxStoreException: The get method which
returns an enum instance does not exist for the class:
org.eclipse.emf.common.util.Enumerator

I believe the error is coming when it attempts to create the column for a
xsd:complexType that contains a xsd:simpleType that is the xsd:union of
three other simpleTypes which are xsd:enumerations, see below:

<xs:complexType name="Message">
<xs:sequence>
<xs:element name="dateTime" type="xs:dateTime"/>
<xs:element name="source" type="msg:EnumComponent"/>
<xs:element name="computerName" type="xs:string"/>
<xs:element name="userName" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:simpleType name="EnumComponent">
<xs:union memberTypes=
"msg:EnumImagerComponent msg:EnumScanComponent
msg:EnumCalibComponent"/>
</xs:simpleType>

<xs:simpleType name="EnumImagerComponent">
<xs:restriction base="xs:string">
<xs:enumeration ecore:name="EPS_1" value="EPS-1"/>
<xs:enumeration ecore:name="EPS_2" value="EPS-2"/>
...

From the comments in ENumMapping.java, I understand in order to persist a
enum, a method with the signature: static get(String) must be present.
But when the model code is generated from the schemas, the
Message.getSource() gets a return type of
org.eclipse.emf.common.util.Enumerator which cannot be persisted.

Is my understanding of what is happening correct? Is this possible? If
not, can the schema be modeled differently to achieve the same effect?

Thanks for any help,
Greg
Re: [Teneo] JpoxStoreException initializing dataStore when object uses Enumerator [message #425269 is a reply to message #425250] Fri, 21 November 2008 11:57 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Greg,
Teneo-Jpox supports enumerates, but only the generated variant which has this get method. I think
the api is generated like this because you use a union of different enums. So introducing a
simpletype which is not an union would probably solve this. Another approach would be to implement
your own EnumMapping which handles this better. The enummapping is used in the
JpoxDataStore.initializeTypeManager mapping. So if you want to do this you also need to override
jpoxdatastore and this method to pass your own enummapping to jpox.

I hope this helps a bit.

gr. Martin

Greg Kirby wrote:
> I am getting the following exception when I attempt to initialize a
> jpoxDataStore for the first time:
> org.eclipse.emf.teneo.jpox.JpoxStoreException: The get method which
> returns an enum instance does not exist for the class:
> org.eclipse.emf.common.util.Enumerator
>
> I believe the error is coming when it attempts to create the column for
> a xsd:complexType that contains a xsd:simpleType that is the xsd:union
> of three other simpleTypes which are xsd:enumerations, see below:
>
> <xs:complexType name="Message">
> <xs:sequence>
> <xs:element name="dateTime" type="xs:dateTime"/>
> <xs:element name="source" type="msg:EnumComponent"/>
> <xs:element name="computerName" type="xs:string"/>
> <xs:element name="userName" type="xs:string" minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> <xs:simpleType name="EnumComponent">
> <xs:union memberTypes=
> "msg:EnumImagerComponent msg:EnumScanComponent
> msg:EnumCalibComponent"/>
> </xs:simpleType>
>
> <xs:simpleType name="EnumImagerComponent">
> <xs:restriction base="xs:string">
> <xs:enumeration ecore:name="EPS_1" value="EPS-1"/>
> <xs:enumeration ecore:name="EPS_2" value="EPS-2"/>
> ...
>
> From the comments in ENumMapping.java, I understand in order to persist
> a enum, a method with the signature: static get(String) must be
> present. But when the model code is generated from the schemas, the
> Message.getSource() gets a return type of
> org.eclipse.emf.common.util.Enumerator which cannot be persisted.
>
> Is my understanding of what is happening correct? Is this possible? If
> not, can the schema be modeled differently to achieve the same effect?
>
> Thanks for any help,
> Greg
>
>
>
>


--

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] problem I can't resolve
Next Topic:[CDO] ClassRef unresolveable
Goto Forum:
  


Current Time: Fri Mar 29 05:06:44 GMT 2024

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

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

Back to the top