Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » ClassCastException to EList
ClassCastException to EList [message #618077] Tue, 20 May 2008 21:06
Eclipse UserFriend
Originally posted by: insanitydesign.yahoo.de

Hello,

I am currently conducting some research on how to maybe change the
software development workflow and structure in my institute. As I do
not like too suffocating solutions I thought about some modelling
approach through EMF, Teneo and DataNucleus.

So I got myself everything needed, read all guides I could find on
eclipse.org, elver.org and datanucleus.org and started with a basic
model with basic relations. Everything worked so far as that I could
- build the model (the example model from this site http://www.eclipse.org/gmt/oaw/doc/4.2/html/contents/emf_tut orial.html),
- create the genmodel,
- generated the code and even the
- package.jdo.
Everything got enhanced and then I thought I could start persisting
everything... so I thought. All the time I get the error:
java.lang.ClassCastException: org.datanucleus.sco.List cannot be cast
to org.eclipse.emf.common.util.EList

I looked it up, searched the newslists and forums but I couldn't figure
out the solution. I know that there is probably an error about the
implementing SCO for EList and DataNucleus, but I cannot figure out
how to tell him what to use. I found tutorials about extensions and
tried that but maybe I am just to slow for that. I do not really get the
TypeMapping.

The code is plain simple I think:

PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory("datanucleus.properties ");
PersistenceManager pm = pmf.getPersistenceManager();

Transaction tx = pm.currentTransaction();
try {
tx.begin();

//
DataModel datamodel = DataFactory.eINSTANCE.createDataModel();
datamodel.setName("DataModel");

//
pm.makePersistent(datamodel);

tx.commit();

} finally {
if(tx.isActive()) {
tx.rollback();
}
pm.close();
}

The tables are created in the database (a test MySQL DB). But
pm.makePersistent(datamodel); kicks him out with the exception.

I tried the creation with

JpoxDataStore jpoxDataStore = JpoxHelper.INSTANCE.createRegisterDataStore("Data");

but that throws errors from the beginning, as I think maybe something
changed from Jpox to DataNucleus. So I tried older versions, before
DataNucleus, so with Jpox directly, then the jpoxDataStore.initialize();
keeps getting errors.

As you can see I am very desperate at the moment and I hope anyone can help me.

Many many thanks in advance and thanks for every response.


Regards
Ziplies


PS: I am using Eclipse 3.4M7 (but I have different installations
with different plugins running, for testing purposes),
EMF 2.4.0v200805052017 and Teneo 0.8.0v200804231747 with DataNucleus 1.0.0m1.

The ecore model is following, the rest is generated through the described plugins
plus my Test Class up above:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="data"
nsURI="http://www.openarchitectureware.org/oaw4.demo.emf.datamodel" nsPrefix="data">
<eClassifiers xsi:type="ecore:EClass" name="DataModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="entity" upperBound="-1"
eType="#//Entity" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Entity">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="attribute" lowerBound="1"
upperBound="-1" eType="#//Attribute" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="reference" upperBound="-1"
eType="#//EntityReference" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Attribute">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="EntityReference">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="toMany" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
eType="#//Entity"/>
</eClassifiers>
</ecore:EPackage>
Previous Topic:Merging UML models
Next Topic:MWE on update site
Goto Forum:
  


Current Time: Thu Apr 02 17:25:39 GMT 2020

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

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

Back to the top