|
Re: [Teneo] JpoxStoreException initializing dataStore when object uses Enumerator [message #425269 is a reply to message #425250] |
Fri, 21 November 2008 11:57 |
Martin Taal 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
|
|
|
Powered by
FUDForum. Page generated in 0.02796 seconds