Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo]Problems when deleting object
[Teneo]Problems when deleting object [message #608681] Tue, 10 July 2007 16:01
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

This is a multi-part message in MIME format.
--------------010107060802050301020403
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello List,

I'm new on Teneo and I'm experiencing problems.


I'm using Teneo to store EPackage. But when I want to delete a package
from the datastore, I obtain an exception :
org.hibernate.LazyInitializationException: illegal access to
loading collection

The only solution that I have found is to do a loop on all the contents
of the package, but it's not very optimized.

I have read that's because Teneo load only the thing that where usefull
with the lazy loading but I don't have found a best solution.


Anyone can help me ?


Thanks


Guillaume


PS : The files of the exceptions and of the code are join to this post.
I'm on eclipse 3.3 and Teneo 0.8

--------------010107060802050301020403
Content-Type: text/x-java;
name="code.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="code.java"


final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, usr);
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
props.setProperty(Environment.PASS, pwd);
props.setProperty(Environment.DIALECT, org.hibernate.dialect.MySQLInnoDBDialect.class.getName());
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, InheritanceType.SINGLE_TABLE_LITERAL.getName());
// create the HbDataStore
hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
// set the relational database to use and other properties
hbds.setHibernateProperties(props);
EPackage[] tpack = new EPackage[]{EcorePackage.eINSTANCE};
// configure EPackage used in this datastore
hbds.setEPackages(tpack);

hbds.initialize();

String uristr = "hibernate://?" + HibernateResource.DS_NAME_PARAM +
"=" + hbName+"&loadStrategy=addToContents&query1 =FROM "+rootelem+" WHERE e_id="+e_id;
Resource res = resTeneo.createResource(URI.createURI(uristr));
res.load(Collections.EMPTY_MAP);
EPackage delme = (EPackage) res.getContents().get(0);

// The loop that i must add to avoid the exception
// TreeIterator<EObject> it = delme.eAllContents();
// while(it.hasNext()){
// EObject eo = it.next();
// }
res.getContents().clear();
res.save(null); // here come the exception



--------------010107060802050301020403
Content-Type: text/plain;
name="exception.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="exception.txt"

org.eclipse.emf.teneo.hibernate.HbMapperException: Exception when saving
resource MySF
at
org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:353)
at org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:362)
at test.newtest.delPackageFromTeneo(newtest.java:353)
at test.newtest.deleteMetaModel(newtest.java:313)
at test.newtest.main(newtest.java:714)
Caused by: org.hibernate.LazyInitializationException: illegal access to
loading collection
at
org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:341)
at
org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentList.toArray(PersistentLi st.java:123)
at
org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersi stableEList.doLoad(HibernatePersistableEList.java:133)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.load(Pe rsistableEList.java:199)
at
org.eclipse.emf.teneo.mapping.elist.PersistableEList.delegat eIndexOf(PersistableEList.java:357)
at
org.eclipse.emf.common.util.DelegatingEList.indexOf(Delegati ngEList.java:305)
at
org.eclipse.emf.ecore.util.DelegatingEcoreEList.indexOf(Dele gatingEcoreEList.java:506)
at
org.eclipse.emf.ecore.impl.EGenericTypeImpl.setERawType(EGen ericTypeImpl.java:331)
at
org.eclipse.emf.ecore.impl.EGenericTypeImpl.setEClassifier(E GenericTypeImpl.java:586)
at
org.eclipse.emf.ecore.impl.EGenericTypeImpl.eSet(EGenericTyp eImpl.java:667)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
at
org.eclipse.emf.teneo.hibernate.mapping.property.EReferenceP ropertyHandler.set(EReferencePropertyHandler.java:133)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropert yValues(AbstractEntityTuplizer.java:337)
at
org.hibernate.persister.entity.AbstractEntityPersister.setPr opertyValues(AbstractEntityPersister.java:3499)
....

--------------010107060802050301020403--
Previous Topic:[EMF Compare] Help with API
Next Topic:Integrating OCL - providing EvaluationEnvironment
Goto Forum:
  


Current Time: Thu Apr 25 21:19:42 GMT 2024

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

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

Back to the top