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 #88756] Tue, 10 July 2007 16:01 Go to next message
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--
Re: [Teneo]Problems when deleting object [message #88860 is a reply to message #88756] Tue, 10 July 2007 19:40 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Guillaume,
I am making some larger changes to Teneo at the moment so I can't yet retest your case. I will be
able to look at your question tomorrow. In the meantime, I noticed that the first part of the
stacktrace was missing. Can you post the complete stacktrace?

gr. Maritn

doux guillaume wrote:
> 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
>
>
> ------------------------------------------------------------ ------------
>
>
> 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
>
>
>
>
> ------------------------------------------------------------ ------------
>
> 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)
> ....


--

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]Problems when deleting object [message #88935 is a reply to message #88860] Wed, 11 July 2007 08:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

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

Martin Taal wrote:
> Hi Guillaume,
> I am making some larger changes to Teneo at the moment so I can't yet
> retest your case. I will be able to look at your question tomorrow. In
> the meantime, I noticed that the first part of the stacktrace was
> missing. Can you post the complete stacktrace?
>
> gr. Maritn
>


Hi,

I post the complete stacktrace that eclipse give me, it left the 2 last
call, but I don't know how to get it, I will try to get a best one.

I have also see that the problem didn't come if I try to delete a
package with one level of content, like this primitive type EPackage :

<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type"
nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"
instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"
instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"
instanceClassName="java.lang.String"/>
</ecore:EPackage>

But when I try with more complex package with more than one level like :

<ecore:EPackage name="rpm" nsURI="my.rpm.model" nsPrefix="rpm">
<eClassifiers xsi:type="ecore:EClass" name="Rpm">
<eStructuralFeatures xsi:type="ecore:EReference" name="lead"
ordered="false"
lowerBound="1" eType="#/1/Lead" containment="true"
eOpposite="#/1/Lead/rpml"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="head"
ordered="false"
lowerBound="1" eType="#/1/Header" containment="true"
eOpposite="#/1/Header/rpmh"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="signature"
ordered="false"
lowerBound="1" eType="#/1/Signature" containment="true"
eOpposite="#/1/Signature/rpms"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="archive"
ordered="false"
lowerBound="1" eType="#/1/Arch" containment="true"
eOpposite="#/1/Arch/rpma"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="name"
ordered="false"
lowerBound="1" eType="#/1/Filename" containment="true"
eOpposite="#/1/Filename/rpmn"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Lead">
<eStructuralFeatures xsi:type="ecore:EReference" name="rpml"
ordered="false"
lowerBound="1" eType="#/1/Rpm" eOpposite="#/1/Rpm/lead"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="magic"
ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="major"
ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
....


It doesn't work and I have my exception.


Thank you to help me,

Guillaume

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

log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" 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.delete.main(delete.java:72)
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)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
at org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
at org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
at org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
at org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
at org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at org.eclipse.emf.teneo.hibernate.HbSessionWrapper.delete(HbSe ssionWrapper.java:148)
at org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:342)
... 2 more

--------------070604070406000000010605--
Re: [Teneo]Problems when deleting object [message #88950 is a reply to message #88935] Wed, 11 July 2007 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

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

doux guillaume wrote:
> Martin Taal wrote:
>> Hi Guillaume,
>> I am making some larger changes to Teneo at the moment so I can't yet
>> retest your case. I will be able to look at your question tomorrow. In
>> the meantime, I noticed that the first part of the stacktrace was
>> missing. Can you post the complete stacktrace?
>>
>> gr. Maritn
>>
>
>

Hi again,

by trying to load my package in an other way, I have reproduced my
exception and have a full stacktrace of it.

I attach the new code to replace loading by a resource and the full
stacktrace.

thanks

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

log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" 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)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
at org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
at org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
at org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
at org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
at org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at test.delete.main(delete.java:94)

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

package test;


import java.io.IOException;
import java.util.Collections;
import java.util.Properties;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;

public class delete {

// resourceSet used with Teneo for operations
private static ResourceSet resTeneo;

// name of the database
private static String dbname = "test";

// the datastore
private static HbDataStore hbds;

// the name of the datastore
private static String hbName = "MySF";

public static void main(String[] args){
resTeneo = new ResourceSetImpl();
resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
new EcoreResourceFactoryImpl());
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, "root");
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
props.setProperty(Environment.PASS, "root");
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();

// code for replacing the loading of the EPackage

// Create a new session and transaction
Session session = hbds.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
// delete the Meta models from the Hbds
Query query = session.createQuery("from EPackage pa left join fetch" +
" pa.eClassifiers where pa.e_id= 50");
EPackage delme = (EPackage) query.list().get(0);
// // the following loop is useless but necessary for deleting
// TreeIterator<EObject> it = delme.eAllContents();
// while(it.hasNext()){
// EObject eo = it.next();
// }
session.delete(delme);

// commit and close transaction
tx.commit();
session.close();
}
}

--------------030205050307080105050001--
Re: [Teneo]Problems when deleting object [message #89194 is a reply to message #88950] Thu, 12 July 2007 08:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

No one can help me ?


Guillaume

doux guillaume wrote:
> doux guillaume wrote:
>> Martin Taal wrote:
>>> Hi Guillaume,
>>> I am making some larger changes to Teneo at the moment so I can't yet
>>> retest your case. I will be able to look at your question tomorrow.
>>> In the meantime, I noticed that the first part of the stacktrace was
>>> missing. Can you post the complete stacktrace?
>>>
>>> gr. Maritn
>>>
>>
>>
>
> Hi again,
>
> by trying to load my package in an other way, I have reproduced my
> exception and have a full stacktrace of it.
>
> I attach the new code to replace loading by a resource and the full
> stacktrace.
>
> thanks
>
>
> ------------------------------------------------------------ ------------
>
> log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
> log4j:WARN Please initialize the log4j system properly.
> Exception in thread "main" 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)
> at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
> at org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
> at org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
> at org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
> at org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
> at org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
> at org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
> at org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
> at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
> at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
> at org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
> at org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
> at org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
> at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
> at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
> at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
> at org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
> at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
> at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
> at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
> at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
> at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
> at test.delete.main(delete.java:94)
>
>
> ------------------------------------------------------------ ------------
>
> package test;
>
>
> import java.io.IOException;
> import java.util.Collections;
> import java.util.Properties;
>
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EcorePackage;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
> import org.eclipse.emf.teneo.PersistenceOptions;
> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
> import org.eclipse.emf.teneo.hibernate.HbDataStore;
> import org.eclipse.emf.teneo.hibernate.HbHelper;
> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
> import org.hibernate.Query;
> import org.hibernate.Session;
> import org.hibernate.Transaction;
> import org.hibernate.cfg.Environment;
>
> public class delete {
>
> // resourceSet used with Teneo for operations
> private static ResourceSet resTeneo;
>
> // name of the database
> private static String dbname = "test";
>
> // the datastore
> private static HbDataStore hbds;
>
> // the name of the datastore
> private static String hbName = "MySF";
>
> public static void main(String[] args){
> resTeneo = new ResourceSetImpl();
> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
> new EcoreResourceFactoryImpl());
> final Properties props = new Properties();
> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
> props.setProperty(Environment.USER, "root");
> props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
> props.setProperty(Environment.PASS, "root");
> 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();
>
> // code for replacing the loading of the EPackage
>
> // Create a new session and transaction
> Session session = hbds.getSessionFactory().openSession();
> Transaction tx = session.beginTransaction();
> // delete the Meta models from the Hbds
> Query query = session.createQuery("from EPackage pa left join fetch" +
> " pa.eClassifiers where pa.e_id= 50");
> EPackage delme = (EPackage) query.list().get(0);
> // // the following loop is useless but necessary for deleting
> // TreeIterator<EObject> it = delme.eAllContents();
> // while(it.hasNext()){
> // EObject eo = it.next();
> // }
> session.delete(delme);
>
> // commit and close transaction
> tx.commit();
> session.close();
> }
> }
Re: [Teneo]Problems when deleting object [message #89224 is a reply to message #89194] Thu, 12 July 2007 09:38 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I am looking at it. I have no solution yet but can you tell you what the cause of the issue is;
This is related to bidirectional relations in a one-to-many. The behavior of EMF to notify the other
side of the relation is interfering with Hibernate's lazy load behavior. Teneo tries to prevent this
from occuring but if hibernate loads a list without going through Teneo then Teneo is not in the
loop. I am currently checking if I can also let Teneo be in the loop when hibernate loads a list
without going through the teneo layer.

As an example:
Assume a model with a parent P which has one or more children C. There is a many-to-one relation
from C to its parent (C.parent) and a one-to-many from parent to C (parent.children). Assume first
only the parent is loaded (so the parent.children is not loaded yet). Then when the parent gets
deleted hb loads parent.children. During the load of this collection, for each child that is loaded
the many-to-one back to the parent is initialized. The relation is bidirectional so when the mto is
initialized the parent is notified that a new child is present, for this notification the collection
of the parent is accessed (indexOf). The indexOf goes through Teneo which detects that the
collection is not yet loaded and then tells hibernate to load it.
Then the exception is thrown because the collection is still in its initialization phase.

gr. Martin

doux guillaume wrote:
> Hi,
>
> No one can help me ?
>
>
> Guillaume
>
> doux guillaume wrote:
>> doux guillaume wrote:
>>> Martin Taal wrote:
>>>> Hi Guillaume,
>>>> I am making some larger changes to Teneo at the moment so I can't
>>>> yet retest your case. I will be able to look at your question
>>>> tomorrow. In the meantime, I noticed that the first part of the
>>>> stacktrace was missing. Can you post the complete stacktrace?
>>>>
>>>> gr. Maritn
>>>>
>>>
>>>
>>
>> Hi again,
>>
>> by trying to load my package in an other way, I have reproduced my
>> exception and have a full stacktrace of it.
>>
>> I attach the new code to replace loading by a resource and the full
>> stacktrace.
>>
>> thanks
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> log4j:WARN No appenders could be found for logger
>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>> log4j:WARN Please initialize the log4j system properly.
>> Exception in thread "main" 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)
>>
>> at
>> org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
>> at
>> org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
>>
>> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>> at
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>
>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>> at
>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>
>> at
>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>
>> at
>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>
>> at
>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>
>> at
>> org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
>> at
>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
>>
>> at
>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
>>
>> at
>> org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
>>
>> at
>> org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
>> at
>> org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
>>
>> at
>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>
>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
>> at
>> org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
>> at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>> at
>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
>>
>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
>> at test.delete.main(delete.java:94)
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> package test;
>>
>>
>> import java.io.IOException;
>> import java.util.Collections;
>> import java.util.Properties;
>>
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EPackage;
>> import org.eclipse.emf.ecore.EcorePackage;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
>> import org.eclipse.emf.teneo.PersistenceOptions;
>> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
>> import org.eclipse.emf.teneo.hibernate.HbDataStore;
>> import org.eclipse.emf.teneo.hibernate.HbHelper;
>> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
>> import org.hibernate.Query;
>> import org.hibernate.Session;
>> import org.hibernate.Transaction;
>> import org.hibernate.cfg.Environment;
>>
>> public class delete {
>>
>> // resourceSet used with Teneo for operations
>> private static ResourceSet resTeneo;
>>
>> // name of the database
>> private static String dbname = "test";
>>
>> // the datastore
>> private static HbDataStore hbds;
>>
>> // the name of the datastore
>> private static String hbName = "MySF";
>>
>> public static void main(String[] args){
>> resTeneo = new ResourceSetImpl();
>>
>> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
>> new EcoreResourceFactoryImpl());
>> final Properties props = new Properties();
>> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
>> props.setProperty(Environment.USER, "root");
>> props.setProperty(Environment.URL,
>> "jdbc:mysql://127.0.0.1:3306/" + dbname);
>> props.setProperty(Environment.PASS, "root");
>> 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();
>>
>> // code for replacing the loading of the EPackage
>>
>> // Create a new session and transaction
>> Session session = hbds.getSessionFactory().openSession();
>> Transaction tx = session.beginTransaction();
>> // delete the Meta models from the Hbds
>> Query query = session.createQuery("from EPackage pa left join
>> fetch" +
>> " pa.eClassifiers where pa.e_id= 50");
>> EPackage delme = (EPackage) query.list().get(0);
>> // // the following loop is useless but necessary for deleting
>> // TreeIterator<EObject> it = delme.eAllContents();
>> // while(it.hasNext()){
>> // EObject eo = it.next();
>> // }
>> session.delete(delme);
>>
>> // commit and close transaction
>> tx.commit();
>> session.close();
>> }
>> }


--

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]Problems when deleting object [message #89254 is a reply to message #89224] Thu, 12 July 2007 10:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090309020007030903060309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

It seems that I have found a way to solve this. I needed to add a initializecollectioneventlistener
to Hibernate. I have attached it. You can just create your own initializecollection event listener
and copy my code into that.

You can the eventlistener as follows.
After
hbds.initialize();

you do this:
final EMFInitializeCollectionEventListener eventListener = new EMFInitializeCollectionEventListener();

((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
new InitializeCollectionEventListener[] { eventListener });


this may not be completely syntactically correct as I copied/pasted to the post but I think you will
get the meaning.

This will be in the next release of Teneo.

Can you let me know if it works for you?

gr. Martin

Martin Taal wrote:
> I am looking at it. I have no solution yet but can you tell you what the
> cause of the issue is;
> This is related to bidirectional relations in a one-to-many. The
> behavior of EMF to notify the other side of the relation is interfering
> with Hibernate's lazy load behavior. Teneo tries to prevent this from
> occuring but if hibernate loads a list without going through Teneo then
> Teneo is not in the loop. I am currently checking if I can also let
> Teneo be in the loop when hibernate loads a list without going through
> the teneo layer.
>
> As an example:
> Assume a model with a parent P which has one or more children C. There
> is a many-to-one relation from C to its parent (C.parent) and a
> one-to-many from parent to C (parent.children). Assume first only the
> parent is loaded (so the parent.children is not loaded yet). Then when
> the parent gets deleted hb loads parent.children. During the load of
> this collection, for each child that is loaded the many-to-one back to
> the parent is initialized. The relation is bidirectional so when the mto
> is initialized the parent is notified that a new child is present, for
> this notification the collection of the parent is accessed (indexOf).
> The indexOf goes through Teneo which detects that the collection is not
> yet loaded and then tells hibernate to load it.
> Then the exception is thrown because the collection is still in its
> initialization phase.
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi,
>>
>> No one can help me ?
>>
>>
>> Guillaume
>>
>> doux guillaume wrote:
>>> doux guillaume wrote:
>>>> Martin Taal wrote:
>>>>> Hi Guillaume,
>>>>> I am making some larger changes to Teneo at the moment so I can't
>>>>> yet retest your case. I will be able to look at your question
>>>>> tomorrow. In the meantime, I noticed that the first part of the
>>>>> stacktrace was missing. Can you post the complete stacktrace?
>>>>>
>>>>> gr. Maritn
>>>>>
>>>>
>>>>
>>>
>>> Hi again,
>>>
>>> by trying to load my package in an other way, I have reproduced my
>>> exception and have a full stacktrace of it.
>>>
>>> I attach the new code to replace loading by a resource and the full
>>> stacktrace.
>>>
>>> thanks
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> log4j:WARN No appenders could be found for logger
>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>> log4j:WARN Please initialize the log4j system properly.
>>> Exception in thread "main" 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)
>>>
>>> at
>>> org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
>>>
>>> at
>>> org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
>>>
>>> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>>> at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>
>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>> at
>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>
>>> at
>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>
>>> at
>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>
>>> at
>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>
>>> at
>>> org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
>>>
>>> at
>>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
>>>
>>> at
>>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
>>>
>>> at
>>> org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
>>>
>>> at
>>> org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
>>> at
>>> org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
>>>
>>> at
>>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
>>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>>
>>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
>>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
>>> at
>>> org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
>>> at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
>>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
>>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>>> at
>>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
>>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
>>>
>>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
>>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
>>> at test.delete.main(delete.java:94)
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> package test;
>>>
>>>
>>> import java.io.IOException;
>>> import java.util.Collections;
>>> import java.util.Properties;
>>>
>>> import org.eclipse.emf.common.util.URI;
>>> import org.eclipse.emf.ecore.EPackage;
>>> import org.eclipse.emf.ecore.EcorePackage;
>>> import org.eclipse.emf.ecore.resource.Resource;
>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>> import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
>>> import org.eclipse.emf.teneo.PersistenceOptions;
>>> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
>>> import org.eclipse.emf.teneo.hibernate.HbDataStore;
>>> import org.eclipse.emf.teneo.hibernate.HbHelper;
>>> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
>>> import org.hibernate.Query;
>>> import org.hibernate.Session;
>>> import org.hibernate.Transaction;
>>> import org.hibernate.cfg.Environment;
>>>
>>> public class delete {
>>> // resourceSet used with Teneo for operations
>>> private static ResourceSet resTeneo;
>>>
>>> // name of the database private static String dbname = "test";
>>> // the datastore
>>> private static HbDataStore hbds;
>>> // the name of the datastore
>>> private static String hbName = "MySF";
>>> public static void main(String[] args){
>>> resTeneo = new ResourceSetImpl();
>>>
>>> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
>>> new EcoreResourceFactoryImpl());
>>> final Properties props = new Properties();
>>> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
>>> props.setProperty(Environment.USER, "root");
>>> props.setProperty(Environment.URL,
>>> "jdbc:mysql://127.0.0.1:3306/" + dbname);
>>> props.setProperty(Environment.PASS, "root");
>>> 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();
>>>
>>> // code for replacing the loading of the EPackage
>>>
>>> // Create a new session and transaction
>>> Session session = hbds.getSessionFactory().openSession();
>>> Transaction tx = session.beginTransaction();
>>> // delete the Meta models from the Hbds
>>> Query query = session.createQuery("from EPackage pa left join
>>> fetch" +
>>> " pa.eClassifiers where pa.e_id= 50");
>>> EPackage delme = (EPackage) query.list().get(0);
>>> // // the following loop is useless but necessary for deleting
>>> // TreeIterator<EObject> it = delme.eAllContents();
>>> // while(it.hasNext()){
>>> // EObject eo = it.next();
>>> // }
>>> session.delete(delme);
>>> // commit and close transaction
>>> tx.commit();
>>> session.close();
>>> }
>>> }
>
>


--

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

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

/**
* <copyright>
*
* Copyright (c) 2005, 2006, 2007 Springsite BV (The Netherlands) and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Taal
* </copyright>
*
* $Id: AnyEObjectType.java,v 1.3 2007/02/08 23:11:37 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapping;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.teneo.extension.ExtensionPoint;
import org.hibernate.HibernateException;
import org.hibernate.event.InitializeCollectionEvent;
import org.hibernate.event.def.DefaultInitializeCollectionEventList ener;

/**
* Sets eDeliver to false for the owner of the collection during the initialization of the
* collection.
*
* @author <a href="mailto:mkanaley@tibco.com">Mike Kanaley</a>
*/
public class EMFInitializeCollectionEventListener extends DefaultInitializeCollectionEventListener implements
ExtensionPoint {

private static final long serialVersionUID = 1L;

/*
* (non-Javadoc)
*
* @see org.hibernate.event.def.DefaultInitializeCollectionEventList ener#onInitializeCollection(org.hibernate.event.InitializeCo llectionEvent)
*/
@Override
public void onInitializeCollection(InitializeCollectionEvent event) throws HibernateException {
final Object owner = event.getCollection().getOwner();
boolean setDeliver = false;
boolean eDeliver = false;
EObject eobj = null;
if (owner instanceof EObject) {
eobj = (EObject) owner;
eDeliver = eobj.eDeliver();
try {
// only set to false if it was true
if (eDeliver) {
eobj.eSetDeliver(false);
setDeliver = true;
}
} catch (UnsupportedOperationException e) {
// in this case the eSetDeliver was not overridden from the baseclass
// ignore
}
}
try {
super.onInitializeCollection(event);
} finally {
if (setDeliver) {
eobj.eSetDeliver(eDeliver);
}
}
}
}
--------------090309020007030903060309--
Re: [Teneo]Problems when deleting object [message #89269 is a reply to message #89254] Thu, 12 July 2007 12:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

In order to get the libraries to do this modification, I have had to
import from the Teneo cvs repository the project :
- org.eclipse.emf.teneo
- org.eclipse.emf.teneo.annotations

With this It is syntactically correct, but I have had to change :

props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
InheritanceType.SINGLE_TABLE_LITERAL.getName());

in
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
InheritanceType.SINGLE_TABLE.name());

and now I have a new exception at the instruction hbds.initialize()

I obtain this exception :

log4j:WARN No appenders could be found for logger
(org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
database test droped
database test created
meta datas tables created
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
at test.newtest.teneoMetaModel(newtest.java:180)
at test.newtest.addMetaModel(newtest.java:206)
at test.newtest.main(newtest.java:699)

So I can't test your code.

What must I do to avoid this exception?


thanks for the help,


Guillaume.



Martin Taal wrote:
> It seems that I have found a way to solve this. I needed to add a
> initializecollectioneventlistener to Hibernate. I have attached it. You
> can just create your own initializecollection event listener and copy my
> code into that.
>
> You can the eventlistener as follows.
> After
> hbds.initialize();
>
> you do this:
> final EMFInitializeCollectionEventListener eventListener = new
> EMFInitializeCollectionEventListener();
>
> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>
> new InitializeCollectionEventListener[] { eventListener });
>
>
> this may not be completely syntactically correct as I copied/pasted to
> the post but I think you will get the meaning.
>
> This will be in the next release of Teneo.
>
> Can you let me know if it works for you?
>
> gr. Martin
>
Re: [Teneo]Problems when deleting object [message #89284 is a reply to message #89269] Thu, 12 July 2007 12:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Guillaume,
You can just create your own initializecollectioneventlistener and copy the code from the event
listener I sent. Then I don't think you need to do a get latest from cvs (please correct me if I am
wrong).

gr. Martin

doux guillaume wrote:
> Hi again,
>
> In order to get the libraries to do this modification, I have had to
> import from the Teneo cvs repository the project :
> - org.eclipse.emf.teneo
> - org.eclipse.emf.teneo.annotations
>
> With this It is syntactically correct, but I have had to change :
>
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>
> in
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
> InheritanceType.SINGLE_TABLE.name());
>
> and now I have a new exception at the instruction hbds.initialize()
>
> I obtain this exception :
>
> log4j:WARN No appenders could be found for logger
> (org.eclipse.emf.teneo.hibernate.HbHelper).
> log4j:WARN Please initialize the log4j system properly.
> database test droped
> database test created
> meta datas tables created
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>
> at test.newtest.teneoMetaModel(newtest.java:180)
> at test.newtest.addMetaModel(newtest.java:206)
> at test.newtest.main(newtest.java:699)
>
> So I can't test your code.
>
> What must I do to avoid this exception?
>
>
> thanks for the help,
>
>
> Guillaume.
>
>
>
> Martin Taal wrote:
>> It seems that I have found a way to solve this. I needed to add a
>> initializecollectioneventlistener to Hibernate. I have attached it.
>> You can just create your own initializecollection event listener and
>> copy my code into that.
>>
>> You can the eventlistener as follows.
>> After
>> hbds.initialize();
>>
>> you do this:
>> final EMFInitializeCollectionEventListener eventListener = new
>> EMFInitializeCollectionEventListener();
>>
>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>
>> new InitializeCollectionEventListener[] { eventListener });
>>
>>
>> this may not be completely syntactically correct as I copied/pasted to
>> the post but I think you will get the meaning.
>>
>> This will be in the next release of Teneo.
>>
>> Can you let me know if it works for you?
>>
>> gr. Martin
>>


--

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]Problems when deleting object [message #89299 is a reply to message #89284] Thu, 12 July 2007 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

The problem is that I don't have :
org.eclipse.emf.teneo.extension.ExtensionPoint;

and the code you give to me implements ExtensionPoint, that's why I have
import this.


Guillaume

Martin Taal wrote:
> Hi Guillaume,
> You can just create your own initializecollectioneventlistener and copy
> the code from the event listener I sent. Then I don't think you need to
> do a get latest from cvs (please correct me if I am wrong).
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi again,
>>
>> In order to get the libraries to do this modification, I have had to
>> import from the Teneo cvs repository the project :
>> - org.eclipse.emf.teneo
>> - org.eclipse.emf.teneo.annotations
>>
>> With this It is syntactically correct, but I have had to change :
>>
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>
>> in
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> InheritanceType.SINGLE_TABLE.name());
>>
>> and now I have a new exception at the instruction hbds.initialize()
>>
>> I obtain this exception :
>>
>> log4j:WARN No appenders could be found for logger
>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>> log4j:WARN Please initialize the log4j system properly.
>> database test droped
>> database test created
>> meta datas tables created
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>
>> at test.newtest.teneoMetaModel(newtest.java:180)
>> at test.newtest.addMetaModel(newtest.java:206)
>> at test.newtest.main(newtest.java:699)
>>
>> So I can't test your code.
>>
>> What must I do to avoid this exception?
>>
>>
>> thanks for the help,
>>
>>
>> Guillaume.
>>
>>
>>
>> Martin Taal wrote:
>>> It seems that I have found a way to solve this. I needed to add a
>>> initializecollectioneventlistener to Hibernate. I have attached it.
>>> You can just create your own initializecollection event listener and
>>> copy my code into that.
>>>
>>> You can the eventlistener as follows.
>>> After
>>> hbds.initialize();
>>>
>>> you do this:
>>> final EMFInitializeCollectionEventListener eventListener =
>>> new EMFInitializeCollectionEventListener();
>>>
>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>
>>> new InitializeCollectionEventListener[] { eventListener });
>>>
>>>
>>> this may not be completely syntactically correct as I copied/pasted
>>> to the post but I think you will get the meaning.
>>>
>>> This will be in the next release of Teneo.
>>>
>>> Can you let me know if it works for you?
>>>
>>> gr. Martin
>>>
>
>
Re: [Teneo]Problems when deleting object [message #89314 is a reply to message #89299] Thu, 12 July 2007 13:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

I have try your code without the "implements ExtensionPoint" in
EMFInitializeCollect then I can test it,
but I obtain always my org.hibernate.LazyInitializationException...

Guillaume



doux guillaume wrote:
> Hi,
>
> The problem is that I don't have :
> org.eclipse.emf.teneo.extension.ExtensionPoint;
>
> and the code you give to me implements ExtensionPoint, that's why I have
> import this.
>
>
> Guillaume
>
> Martin Taal wrote:
>> Hi Guillaume,
>> You can just create your own initializecollectioneventlistener and
>> copy the code from the event listener I sent. Then I don't think you
>> need to do a get latest from cvs (please correct me if I am wrong).
>>
>> gr. Martin
>>
>> doux guillaume wrote:
>>> Hi again,
>>>
>>> In order to get the libraries to do this modification, I have had to
>>> import from the Teneo cvs repository the project :
>>> - org.eclipse.emf.teneo
>>> - org.eclipse.emf.teneo.annotations
>>>
>>> With this It is syntactically correct, but I have had to change :
>>>
>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>
>>> in
>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>> InheritanceType.SINGLE_TABLE.name());
>>>
>>> and now I have a new exception at the instruction hbds.initialize()
>>>
>>> I obtain this exception :
>>>
>>> log4j:WARN No appenders could be found for logger
>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>> log4j:WARN Please initialize the log4j system properly.
>>> database test droped
>>> database test created
>>> meta datas tables created
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>
>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>> at test.newtest.addMetaModel(newtest.java:206)
>>> at test.newtest.main(newtest.java:699)
>>>
>>> So I can't test your code.
>>>
>>> What must I do to avoid this exception?
>>>
>>>
>>> thanks for the help,
>>>
>>>
>>> Guillaume.
>>>
>>>
>>>
>>> Martin Taal wrote:
>>>> It seems that I have found a way to solve this. I needed to add a
>>>> initializecollectioneventlistener to Hibernate. I have attached it.
>>>> You can just create your own initializecollection event listener and
>>>> copy my code into that.
>>>>
>>>> You can the eventlistener as follows.
>>>> After
>>>> hbds.initialize();
>>>>
>>>> you do this:
>>>> final EMFInitializeCollectionEventListener eventListener =
>>>> new EMFInitializeCollectionEventListener();
>>>>
>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>
>>>> new InitializeCollectionEventListener[] { eventListener });
>>>>
>>>>
>>>> this may not be completely syntactically correct as I copied/pasted
>>>> to the post but I think you will get the meaning.
>>>>
>>>> This will be in the next release of Teneo.
>>>>
>>>> Can you let me know if it works for you?
>>>>
>>>> gr. Martin
>>>>
>>
>>
Re: [Teneo]Problems when deleting object [message #89329 is a reply to message #89314] Thu, 12 July 2007 13:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Forgot this, because the event listener is set after the hbds.initialize() you have to get a new
sessionFactory.

SessionFactory sf = ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
Session session = sf.getSessionFactory().openSession();
and then do the rest...

gr. Martin

doux guillaume wrote:
> Hi again,
>
> I have try your code without the "implements ExtensionPoint" in
> EMFInitializeCollect then I can test it,
> but I obtain always my org.hibernate.LazyInitializationException...
>
> Guillaume
>
>
>
> doux guillaume wrote:
>> Hi,
>>
>> The problem is that I don't have :
>> org.eclipse.emf.teneo.extension.ExtensionPoint;
>>
>> and the code you give to me implements ExtensionPoint, that's why I
>> have import this.
>>
>>
>> Guillaume
>>
>> Martin Taal wrote:
>>> Hi Guillaume,
>>> You can just create your own initializecollectioneventlistener and
>>> copy the code from the event listener I sent. Then I don't think you
>>> need to do a get latest from cvs (please correct me if I am wrong).
>>>
>>> gr. Martin
>>>
>>> doux guillaume wrote:
>>>> Hi again,
>>>>
>>>> In order to get the libraries to do this modification, I have had to
>>>> import from the Teneo cvs repository the project :
>>>> - org.eclipse.emf.teneo
>>>> - org.eclipse.emf.teneo.annotations
>>>>
>>>> With this It is syntactically correct, but I have had to change :
>>>>
>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>>
>>>> in
>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>> InheritanceType.SINGLE_TABLE.name());
>>>>
>>>> and now I have a new exception at the instruction hbds.initialize()
>>>>
>>>> I obtain this exception :
>>>>
>>>> log4j:WARN No appenders could be found for logger
>>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>>> log4j:WARN Please initialize the log4j system properly.
>>>> database test droped
>>>> database test created
>>>> meta datas tables created
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>>
>>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>>> at test.newtest.addMetaModel(newtest.java:206)
>>>> at test.newtest.main(newtest.java:699)
>>>>
>>>> So I can't test your code.
>>>>
>>>> What must I do to avoid this exception?
>>>>
>>>>
>>>> thanks for the help,
>>>>
>>>>
>>>> Guillaume.
>>>>
>>>>
>>>>
>>>> Martin Taal wrote:
>>>>> It seems that I have found a way to solve this. I needed to add a
>>>>> initializecollectioneventlistener to Hibernate. I have attached it.
>>>>> You can just create your own initializecollection event listener
>>>>> and copy my code into that.
>>>>>
>>>>> You can the eventlistener as follows.
>>>>> After
>>>>> hbds.initialize();
>>>>>
>>>>> you do this:
>>>>> final EMFInitializeCollectionEventListener eventListener =
>>>>> new EMFInitializeCollectionEventListener();
>>>>>
>>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>>
>>>>> new InitializeCollectionEventListener[] { eventListener
>>>>> });
>>>>>
>>>>>
>>>>> this may not be completely syntactically correct as I copied/pasted
>>>>> to the post but I think you will get the meaning.
>>>>>
>>>>> This will be in the next release of Teneo.
>>>>>
>>>>> Can you let me know if it works for you?
>>>>>
>>>>> gr. Martin
>>>>>
>>>
>>>


--

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]Problems when deleting object [message #89364 is a reply to message #89329] Thu, 12 July 2007 14:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

I have done this :

SessionFactory sf =
((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
Session session = sf.openSession();

And then it works.

Thanks a lot !

Guillaume


Martin Taal wrote:
> Forgot this, because the event listener is set after the
> hbds.initialize() you have to get a new sessionFactory.
>
> SessionFactory sf =
> ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
> Session session = sf.getSessionFactory().openSession();
> and then do the rest...
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi again,
>>
>> I have try your code without the "implements ExtensionPoint" in
>> EMFInitializeCollect then I can test it,
>> but I obtain always my org.hibernate.LazyInitializationException...
>>
>> Guillaume
>>
>>
>>
>> doux guillaume wrote:
>>> Hi,
>>>
>>> The problem is that I don't have :
>>> org.eclipse.emf.teneo.extension.ExtensionPoint;
>>>
>>> and the code you give to me implements ExtensionPoint, that's why I
>>> have import this.
>>>
>>>
>>> Guillaume
>>>
>>> Martin Taal wrote:
>>>> Hi Guillaume,
>>>> You can just create your own initializecollectioneventlistener and
>>>> copy the code from the event listener I sent. Then I don't think you
>>>> need to do a get latest from cvs (please correct me if I am wrong).
>>>>
>>>> gr. Martin
>>>>
>>>> doux guillaume wrote:
>>>>> Hi again,
>>>>>
>>>>> In order to get the libraries to do this modification, I have had
>>>>> to import from the Teneo cvs repository the project :
>>>>> - org.eclipse.emf.teneo
>>>>> - org.eclipse.emf.teneo.annotations
>>>>>
>>>>> With this It is syntactically correct, but I have had to change :
>>>>>
>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>>>
>>>>> in
>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>> InheritanceType.SINGLE_TABLE.name());
>>>>>
>>>>> and now I have a new exception at the instruction hbds.initialize()
>>>>>
>>>>> I obtain this exception :
>>>>>
>>>>> log4j:WARN No appenders could be found for logger
>>>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>>>> log4j:WARN Please initialize the log4j system properly.
>>>>> database test droped
>>>>> database test created
>>>>> meta datas tables created
>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>>>
>>>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>>>> at test.newtest.addMetaModel(newtest.java:206)
>>>>> at test.newtest.main(newtest.java:699)
>>>>>
>>>>> So I can't test your code.
>>>>>
>>>>> What must I do to avoid this exception?
>>>>>
>>>>>
>>>>> thanks for the help,
>>>>>
>>>>>
>>>>> Guillaume.
>>>>>
>>>>>
>>>>>
>>>>> Martin Taal wrote:
>>>>>> It seems that I have found a way to solve this. I needed to add a
>>>>>> initializecollectioneventlistener to Hibernate. I have attached
>>>>>> it. You can just create your own initializecollection event
>>>>>> listener and copy my code into that.
>>>>>>
>>>>>> You can the eventlistener as follows.
>>>>>> After
>>>>>> hbds.initialize();
>>>>>>
>>>>>> you do this:
>>>>>> final EMFInitializeCollectionEventListener eventListener =
>>>>>> new EMFInitializeCollectionEventListener();
>>>>>>
>>>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>>>
>>>>>> new InitializeCollectionEventListener[] {
>>>>>> eventListener });
>>>>>>
>>>>>>
>>>>>> this may not be completely syntactically correct as I
>>>>>> copied/pasted to the post but I think you will get the meaning.
>>>>>>
>>>>>> This will be in the next release of Teneo.
>>>>>>
>>>>>> Can you let me know if it works for you?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>
>>>>
>
>
H
Re: [Teneo]Problems when deleting object [message #89379 is a reply to message #89364] Thu, 12 July 2007 14:06 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Okay great, in the next release of Teneo you won't have to do the extre buildSessionFactory anymore
then the eventlistener will be set as part of the initialization step of the datastore.

gr. Martin

doux guillaume wrote:
> Hi again,
>
> I have done this :
>
> SessionFactory sf =
> ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
> Session session = sf.openSession();
>
> And then it works.
>
> Thanks a lot !
>
> Guillaume
>
>
> Martin Taal wrote:
>> Forgot this, because the event listener is set after the
>> hbds.initialize() you have to get a new sessionFactory.
>>
>> SessionFactory sf =
>> ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
>> Session session = sf.getSessionFactory().openSession();
>> and then do the rest...
>>
>> gr. Martin
>>
>> doux guillaume wrote:
>>> Hi again,
>>>
>>> I have try your code without the "implements ExtensionPoint" in
>>> EMFInitializeCollect then I can test it,
>>> but I obtain always my org.hibernate.LazyInitializationException...
>>>
>>> Guillaume
>>>
>>>
>>>
>>> doux guillaume wrote:
>>>> Hi,
>>>>
>>>> The problem is that I don't have :
>>>> org.eclipse.emf.teneo.extension.ExtensionPoint;
>>>>
>>>> and the code you give to me implements ExtensionPoint, that's why I
>>>> have import this.
>>>>
>>>>
>>>> Guillaume
>>>>
>>>> Martin Taal wrote:
>>>>> Hi Guillaume,
>>>>> You can just create your own initializecollectioneventlistener and
>>>>> copy the code from the event listener I sent. Then I don't think
>>>>> you need to do a get latest from cvs (please correct me if I am
>>>>> wrong).
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> doux guillaume wrote:
>>>>>> Hi again,
>>>>>>
>>>>>> In order to get the libraries to do this modification, I have had
>>>>>> to import from the Teneo cvs repository the project :
>>>>>> - org.eclipse.emf.teneo
>>>>>> - org.eclipse.emf.teneo.annotations
>>>>>>
>>>>>> With this It is syntactically correct, but I have had to change :
>>>>>>
>>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>>>>
>>>>>> in
>>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>>> InheritanceType.SINGLE_TABLE.name());
>>>>>>
>>>>>> and now I have a new exception at the instruction hbds.initialize()
>>>>>>
>>>>>> I obtain this exception :
>>>>>>
>>>>>> log4j:WARN No appenders could be found for logger
>>>>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>>>>> log4j:WARN Please initialize the log4j system properly.
>>>>>> database test droped
>>>>>> database test created
>>>>>> meta datas tables created
>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>>>>
>>>>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>>>>> at test.newtest.addMetaModel(newtest.java:206)
>>>>>> at test.newtest.main(newtest.java:699)
>>>>>>
>>>>>> So I can't test your code.
>>>>>>
>>>>>> What must I do to avoid this exception?
>>>>>>
>>>>>>
>>>>>> thanks for the help,
>>>>>>
>>>>>>
>>>>>> Guillaume.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martin Taal wrote:
>>>>>>> It seems that I have found a way to solve this. I needed to add a
>>>>>>> initializecollectioneventlistener to Hibernate. I have attached
>>>>>>> it. You can just create your own initializecollection event
>>>>>>> listener and copy my code into that.
>>>>>>>
>>>>>>> You can the eventlistener as follows.
>>>>>>> After
>>>>>>> hbds.initialize();
>>>>>>>
>>>>>>> you do this:
>>>>>>> final EMFInitializeCollectionEventListener eventListener
>>>>>>> = new EMFInitializeCollectionEventListener();
>>>>>>>
>>>>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>>>>
>>>>>>> new InitializeCollectionEventListener[] {
>>>>>>> eventListener });
>>>>>>>
>>>>>>>
>>>>>>> this may not be completely syntactically correct as I
>>>>>>> copied/pasted to the post but I think you will get the meaning.
>>>>>>>
>>>>>>> This will be in the next release of Teneo.
>>>>>>>
>>>>>>> Can you let me know if it works for you?
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>
>>>>>
>>
>>
> H


--

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]Problems when deleting object [message #608688 is a reply to message #88756] Tue, 10 July 2007 19:40 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Guillaume,
I am making some larger changes to Teneo at the moment so I can't yet retest your case. I will be
able to look at your question tomorrow. In the meantime, I noticed that the first part of the
stacktrace was missing. Can you post the complete stacktrace?

gr. Maritn

doux guillaume wrote:
> 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
>
>
> ------------------------------------------------------------ ------------
>
>
> 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
>
>
>
>
> ------------------------------------------------------------ ------------
>
> 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)
> ....


--

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]Problems when deleting object [message #608693 is a reply to message #88860] Wed, 11 July 2007 08:47 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

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

Martin Taal wrote:
> Hi Guillaume,
> I am making some larger changes to Teneo at the moment so I can't yet
> retest your case. I will be able to look at your question tomorrow. In
> the meantime, I noticed that the first part of the stacktrace was
> missing. Can you post the complete stacktrace?
>
> gr. Maritn
>


Hi,

I post the complete stacktrace that eclipse give me, it left the 2 last
call, but I don't know how to get it, I will try to get a best one.

I have also see that the problem didn't come if I try to delete a
package with one level of content, like this primitive type EPackage :

<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type"
nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"
instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"
instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"
instanceClassName="java.lang.String"/>
</ecore:EPackage>

But when I try with more complex package with more than one level like :

<ecore:EPackage name="rpm" nsURI="my.rpm.model" nsPrefix="rpm">
<eClassifiers xsi:type="ecore:EClass" name="Rpm">
<eStructuralFeatures xsi:type="ecore:EReference" name="lead"
ordered="false"
lowerBound="1" eType="#/1/Lead" containment="true"
eOpposite="#/1/Lead/rpml"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="head"
ordered="false"
lowerBound="1" eType="#/1/Header" containment="true"
eOpposite="#/1/Header/rpmh"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="signature"
ordered="false"
lowerBound="1" eType="#/1/Signature" containment="true"
eOpposite="#/1/Signature/rpms"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="archive"
ordered="false"
lowerBound="1" eType="#/1/Arch" containment="true"
eOpposite="#/1/Arch/rpma"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="name"
ordered="false"
lowerBound="1" eType="#/1/Filename" containment="true"
eOpposite="#/1/Filename/rpmn"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Lead">
<eStructuralFeatures xsi:type="ecore:EReference" name="rpml"
ordered="false"
lowerBound="1" eType="#/1/Rpm" eOpposite="#/1/Rpm/lead"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="magic"
ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="major"
ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
....


It doesn't work and I have my exception.


Thank you to help me,

Guillaume

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

log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" 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.delete.main(delete.java:72)
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)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
at org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
at org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
at org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
at org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
at org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at org.eclipse.emf.teneo.hibernate.HbSessionWrapper.delete(HbSe ssionWrapper.java:148)
at org.eclipse.emf.teneo.hibernate.resource.HibernateResource.s aveResource(HibernateResource.java:342)
... 2 more

--------------070604070406000000010605--
Re: [Teneo]Problems when deleting object [message #608694 is a reply to message #88935] Wed, 11 July 2007 09:04 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

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

doux guillaume wrote:
> Martin Taal wrote:
>> Hi Guillaume,
>> I am making some larger changes to Teneo at the moment so I can't yet
>> retest your case. I will be able to look at your question tomorrow. In
>> the meantime, I noticed that the first part of the stacktrace was
>> missing. Can you post the complete stacktrace?
>>
>> gr. Maritn
>>
>
>

Hi again,

by trying to load my package in an other way, I have reproduced my
exception and have a full stacktrace of it.

I attach the new code to replace loading by a resource and the full
stacktrace.

thanks

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

log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" 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)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
at org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
at org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
at org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
at org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
at org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
at org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
at test.delete.main(delete.java:94)

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

package test;


import java.io.IOException;
import java.util.Collections;
import java.util.Properties;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.teneo.PersistenceOptions;
import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
import org.eclipse.emf.teneo.hibernate.HbDataStore;
import org.eclipse.emf.teneo.hibernate.HbHelper;
import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Environment;

public class delete {

// resourceSet used with Teneo for operations
private static ResourceSet resTeneo;

// name of the database
private static String dbname = "test";

// the datastore
private static HbDataStore hbds;

// the name of the datastore
private static String hbName = "MySF";

public static void main(String[] args){
resTeneo = new ResourceSetImpl();
resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
new EcoreResourceFactoryImpl());
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, "root");
props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
props.setProperty(Environment.PASS, "root");
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();

// code for replacing the loading of the EPackage

// Create a new session and transaction
Session session = hbds.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
// delete the Meta models from the Hbds
Query query = session.createQuery("from EPackage pa left join fetch" +
" pa.eClassifiers where pa.e_id= 50");
EPackage delme = (EPackage) query.list().get(0);
// // the following loop is useless but necessary for deleting
// TreeIterator<EObject> it = delme.eAllContents();
// while(it.hasNext()){
// EObject eo = it.next();
// }
session.delete(delme);

// commit and close transaction
tx.commit();
session.close();
}
}

--------------030205050307080105050001--
Re: [Teneo]Problems when deleting object [message #608710 is a reply to message #88950] Thu, 12 July 2007 08:16 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

No one can help me ?


Guillaume

doux guillaume wrote:
> doux guillaume wrote:
>> Martin Taal wrote:
>>> Hi Guillaume,
>>> I am making some larger changes to Teneo at the moment so I can't yet
>>> retest your case. I will be able to look at your question tomorrow.
>>> In the meantime, I noticed that the first part of the stacktrace was
>>> missing. Can you post the complete stacktrace?
>>>
>>> gr. Maritn
>>>
>>
>>
>
> Hi again,
>
> by trying to load my package in an other way, I have reproduced my
> exception and have a full stacktrace of it.
>
> I attach the new code to replace loading by a resource and the full
> stacktrace.
>
> thanks
>
>
> ------------------------------------------------------------ ------------
>
> log4j:WARN No appenders could be found for logger (org.eclipse.emf.teneo.hibernate.HbHelper).
> log4j:WARN Please initialize the log4j system properly.
> Exception in thread "main" 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)
> at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
> at org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
> at org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
> at org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
> at org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
> at org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
> at org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
> at org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
> at org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
> at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
> at org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
> at org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
> at org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
> at org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
> at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
> at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
> at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
> at org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
> at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
> at org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
> at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
> at org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
> at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
> at org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
> at test.delete.main(delete.java:94)
>
>
> ------------------------------------------------------------ ------------
>
> package test;
>
>
> import java.io.IOException;
> import java.util.Collections;
> import java.util.Properties;
>
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.ecore.EcorePackage;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
> import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
> import org.eclipse.emf.teneo.PersistenceOptions;
> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
> import org.eclipse.emf.teneo.hibernate.HbDataStore;
> import org.eclipse.emf.teneo.hibernate.HbHelper;
> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
> import org.hibernate.Query;
> import org.hibernate.Session;
> import org.hibernate.Transaction;
> import org.hibernate.cfg.Environment;
>
> public class delete {
>
> // resourceSet used with Teneo for operations
> private static ResourceSet resTeneo;
>
> // name of the database
> private static String dbname = "test";
>
> // the datastore
> private static HbDataStore hbds;
>
> // the name of the datastore
> private static String hbName = "MySF";
>
> public static void main(String[] args){
> resTeneo = new ResourceSetImpl();
> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
> new EcoreResourceFactoryImpl());
> final Properties props = new Properties();
> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
> props.setProperty(Environment.USER, "root");
> props.setProperty(Environment.URL, "jdbc:mysql://127.0.0.1:3306/" + dbname);
> props.setProperty(Environment.PASS, "root");
> 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();
>
> // code for replacing the loading of the EPackage
>
> // Create a new session and transaction
> Session session = hbds.getSessionFactory().openSession();
> Transaction tx = session.beginTransaction();
> // delete the Meta models from the Hbds
> Query query = session.createQuery("from EPackage pa left join fetch" +
> " pa.eClassifiers where pa.e_id= 50");
> EPackage delme = (EPackage) query.list().get(0);
> // // the following loop is useless but necessary for deleting
> // TreeIterator<EObject> it = delme.eAllContents();
> // while(it.hasNext()){
> // EObject eo = it.next();
> // }
> session.delete(delme);
>
> // commit and close transaction
> tx.commit();
> session.close();
> }
> }
Re: [Teneo]Problems when deleting object [message #608712 is a reply to message #89194] Thu, 12 July 2007 09:38 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I am looking at it. I have no solution yet but can you tell you what the cause of the issue is;
This is related to bidirectional relations in a one-to-many. The behavior of EMF to notify the other
side of the relation is interfering with Hibernate's lazy load behavior. Teneo tries to prevent this
from occuring but if hibernate loads a list without going through Teneo then Teneo is not in the
loop. I am currently checking if I can also let Teneo be in the loop when hibernate loads a list
without going through the teneo layer.

As an example:
Assume a model with a parent P which has one or more children C. There is a many-to-one relation
from C to its parent (C.parent) and a one-to-many from parent to C (parent.children). Assume first
only the parent is loaded (so the parent.children is not loaded yet). Then when the parent gets
deleted hb loads parent.children. During the load of this collection, for each child that is loaded
the many-to-one back to the parent is initialized. The relation is bidirectional so when the mto is
initialized the parent is notified that a new child is present, for this notification the collection
of the parent is accessed (indexOf). The indexOf goes through Teneo which detects that the
collection is not yet loaded and then tells hibernate to load it.
Then the exception is thrown because the collection is still in its initialization phase.

gr. Martin

doux guillaume wrote:
> Hi,
>
> No one can help me ?
>
>
> Guillaume
>
> doux guillaume wrote:
>> doux guillaume wrote:
>>> Martin Taal wrote:
>>>> Hi Guillaume,
>>>> I am making some larger changes to Teneo at the moment so I can't
>>>> yet retest your case. I will be able to look at your question
>>>> tomorrow. In the meantime, I noticed that the first part of the
>>>> stacktrace was missing. Can you post the complete stacktrace?
>>>>
>>>> gr. Maritn
>>>>
>>>
>>>
>>
>> Hi again,
>>
>> by trying to load my package in an other way, I have reproduced my
>> exception and have a full stacktrace of it.
>>
>> I attach the new code to replace loading by a resource and the full
>> stacktrace.
>>
>> thanks
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> log4j:WARN No appenders could be found for logger
>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>> log4j:WARN Please initialize the log4j system properly.
>> Exception in thread "main" 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)
>>
>> at
>> org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
>> at
>> org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
>>
>> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>> at
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>
>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>> at
>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>
>> at
>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>
>> at
>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>
>> at
>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>
>> at
>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>
>> at
>> org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
>> at
>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
>>
>> at
>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
>>
>> at
>> org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
>>
>> at
>> org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
>> at
>> org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
>>
>> at
>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>
>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
>> at
>> org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
>> at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>> at
>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>
>> at
>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
>>
>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
>> at test.delete.main(delete.java:94)
>>
>>
>> ------------------------------------------------------------ ------------
>>
>> package test;
>>
>>
>> import java.io.IOException;
>> import java.util.Collections;
>> import java.util.Properties;
>>
>> import org.eclipse.emf.common.util.URI;
>> import org.eclipse.emf.ecore.EPackage;
>> import org.eclipse.emf.ecore.EcorePackage;
>> import org.eclipse.emf.ecore.resource.Resource;
>> import org.eclipse.emf.ecore.resource.ResourceSet;
>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>> import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
>> import org.eclipse.emf.teneo.PersistenceOptions;
>> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
>> import org.eclipse.emf.teneo.hibernate.HbDataStore;
>> import org.eclipse.emf.teneo.hibernate.HbHelper;
>> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
>> import org.hibernate.Query;
>> import org.hibernate.Session;
>> import org.hibernate.Transaction;
>> import org.hibernate.cfg.Environment;
>>
>> public class delete {
>>
>> // resourceSet used with Teneo for operations
>> private static ResourceSet resTeneo;
>>
>> // name of the database
>> private static String dbname = "test";
>>
>> // the datastore
>> private static HbDataStore hbds;
>>
>> // the name of the datastore
>> private static String hbName = "MySF";
>>
>> public static void main(String[] args){
>> resTeneo = new ResourceSetImpl();
>>
>> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
>> new EcoreResourceFactoryImpl());
>> final Properties props = new Properties();
>> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
>> props.setProperty(Environment.USER, "root");
>> props.setProperty(Environment.URL,
>> "jdbc:mysql://127.0.0.1:3306/" + dbname);
>> props.setProperty(Environment.PASS, "root");
>> 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();
>>
>> // code for replacing the loading of the EPackage
>>
>> // Create a new session and transaction
>> Session session = hbds.getSessionFactory().openSession();
>> Transaction tx = session.beginTransaction();
>> // delete the Meta models from the Hbds
>> Query query = session.createQuery("from EPackage pa left join
>> fetch" +
>> " pa.eClassifiers where pa.e_id= 50");
>> EPackage delme = (EPackage) query.list().get(0);
>> // // the following loop is useless but necessary for deleting
>> // TreeIterator<EObject> it = delme.eAllContents();
>> // while(it.hasNext()){
>> // EObject eo = it.next();
>> // }
>> session.delete(delme);
>>
>> // commit and close transaction
>> tx.commit();
>> session.close();
>> }
>> }


--

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]Problems when deleting object [message #608714 is a reply to message #89224] Thu, 12 July 2007 10:15 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090309020007030903060309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

It seems that I have found a way to solve this. I needed to add a initializecollectioneventlistener
to Hibernate. I have attached it. You can just create your own initializecollection event listener
and copy my code into that.

You can the eventlistener as follows.
After
hbds.initialize();

you do this:
final EMFInitializeCollectionEventListener eventListener = new EMFInitializeCollectionEventListener();

((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
new InitializeCollectionEventListener[] { eventListener });


this may not be completely syntactically correct as I copied/pasted to the post but I think you will
get the meaning.

This will be in the next release of Teneo.

Can you let me know if it works for you?

gr. Martin

Martin Taal wrote:
> I am looking at it. I have no solution yet but can you tell you what the
> cause of the issue is;
> This is related to bidirectional relations in a one-to-many. The
> behavior of EMF to notify the other side of the relation is interfering
> with Hibernate's lazy load behavior. Teneo tries to prevent this from
> occuring but if hibernate loads a list without going through Teneo then
> Teneo is not in the loop. I am currently checking if I can also let
> Teneo be in the loop when hibernate loads a list without going through
> the teneo layer.
>
> As an example:
> Assume a model with a parent P which has one or more children C. There
> is a many-to-one relation from C to its parent (C.parent) and a
> one-to-many from parent to C (parent.children). Assume first only the
> parent is loaded (so the parent.children is not loaded yet). Then when
> the parent gets deleted hb loads parent.children. During the load of
> this collection, for each child that is loaded the many-to-one back to
> the parent is initialized. The relation is bidirectional so when the mto
> is initialized the parent is notified that a new child is present, for
> this notification the collection of the parent is accessed (indexOf).
> The indexOf goes through Teneo which detects that the collection is not
> yet loaded and then tells hibernate to load it.
> Then the exception is thrown because the collection is still in its
> initialization phase.
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi,
>>
>> No one can help me ?
>>
>>
>> Guillaume
>>
>> doux guillaume wrote:
>>> doux guillaume wrote:
>>>> Martin Taal wrote:
>>>>> Hi Guillaume,
>>>>> I am making some larger changes to Teneo at the moment so I can't
>>>>> yet retest your case. I will be able to look at your question
>>>>> tomorrow. In the meantime, I noticed that the first part of the
>>>>> stacktrace was missing. Can you post the complete stacktrace?
>>>>>
>>>>> gr. Maritn
>>>>>
>>>>
>>>>
>>>
>>> Hi again,
>>>
>>> by trying to load my package in an other way, I have reproduced my
>>> exception and have a full stacktrace of it.
>>>
>>> I attach the new code to replace loading by a resource and the full
>>> stacktrace.
>>>
>>> thanks
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> log4j:WARN No appenders could be found for logger
>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>> log4j:WARN Please initialize the log4j system properly.
>>> Exception in thread "main" 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)
>>>
>>> at
>>> org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseL oad.java:129)
>>>
>>> at
>>> org.hibernate.loader.Loader.initializeEntitiesAndCollections (Loader.java:842)
>>>
>>> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
>>> at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyColle ctions(Loader.java:224)
>>>
>>> at org.hibernate.loader.Loader.loadCollection(Loader.java:1931)
>>> at
>>> org.hibernate.loader.collection.CollectionLoader.initialize( CollectionLoader.java:36)
>>>
>>> at
>>> org.hibernate.persister.collection.AbstractCollectionPersist er.initialize(AbstractCollectionPersister.java:565)
>>>
>>> at
>>> org.hibernate.event.def.DefaultInitializeCollectionEventList ener.onInitializeCollection(DefaultInitializeCollectionEvent Listener.java:60)
>>>
>>> at
>>> org.hibernate.impl.SessionImpl.initializeCollection(SessionI mpl.java:1716)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.initia lize(AbstractPersistentCollection.java:344)
>>>
>>> at
>>> org.hibernate.collection.AbstractPersistentCollection.read(A bstractPersistentCollection.java:86)
>>>
>>> at
>>> org.hibernate.collection.PersistentList.iterator(PersistentL ist.java:115)
>>>
>>> at
>>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:201)
>>>
>>> at
>>> org.hibernate.type.CollectionType.getElementsIterator(Collec tionType.java:193)
>>>
>>> at
>>> org.hibernate.engine.CascadingAction.getAllElementsIterator( CascadingAction.java:415)
>>>
>>> at
>>> org.hibernate.engine.CascadingAction.access$100(CascadingAct ion.java:27)
>>> at
>>> org.hibernate.engine.CascadingAction$2.getCascadableChildren Iterator(CascadingAction.java:125)
>>>
>>> at
>>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:294)
>>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>>
>>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 75)
>>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
>>> at
>>> org.hibernate.engine.CascadingAction$2.cascade(CascadingActi on.java:121)
>>> at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
>>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :216)
>>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>>> at
>>> org.hibernate.engine.Cascade.cascadeCollectionElements(Casca de.java:296)
>>> at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java: 242)
>>> at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java :219)
>>> at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:16 9)
>>> at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.cascadeBe foreDelete(DefaultDeleteEventListener.java:272)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.deleteEnt ity(DefaultDeleteEventListener.java:220)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:128)
>>>
>>> at
>>> org.hibernate.event.def.DefaultDeleteEventListener.onDelete( DefaultDeleteEventListener.java:49)
>>>
>>> at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:7 66)
>>> at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
>>> at test.delete.main(delete.java:94)
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
>>> package test;
>>>
>>>
>>> import java.io.IOException;
>>> import java.util.Collections;
>>> import java.util.Properties;
>>>
>>> import org.eclipse.emf.common.util.URI;
>>> import org.eclipse.emf.ecore.EPackage;
>>> import org.eclipse.emf.ecore.EcorePackage;
>>> import org.eclipse.emf.ecore.resource.Resource;
>>> import org.eclipse.emf.ecore.resource.ResourceSet;
>>> import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
>>> import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
>>> import org.eclipse.emf.teneo.PersistenceOptions;
>>> import org.eclipse.emf.teneo.annotations.pannotation.InheritanceTyp e;
>>> import org.eclipse.emf.teneo.hibernate.HbDataStore;
>>> import org.eclipse.emf.teneo.hibernate.HbHelper;
>>> import org.eclipse.emf.teneo.hibernate.resource.HibernateResource;
>>> import org.hibernate.Query;
>>> import org.hibernate.Session;
>>> import org.hibernate.Transaction;
>>> import org.hibernate.cfg.Environment;
>>>
>>> public class delete {
>>> // resourceSet used with Teneo for operations
>>> private static ResourceSet resTeneo;
>>>
>>> // name of the database private static String dbname = "test";
>>> // the datastore
>>> private static HbDataStore hbds;
>>> // the name of the datastore
>>> private static String hbName = "MySF";
>>> public static void main(String[] args){
>>> resTeneo = new ResourceSetImpl();
>>>
>>> resTeneo.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "ecore",
>>> new EcoreResourceFactoryImpl());
>>> final Properties props = new Properties();
>>> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
>>> props.setProperty(Environment.USER, "root");
>>> props.setProperty(Environment.URL,
>>> "jdbc:mysql://127.0.0.1:3306/" + dbname);
>>> props.setProperty(Environment.PASS, "root");
>>> 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();
>>>
>>> // code for replacing the loading of the EPackage
>>>
>>> // Create a new session and transaction
>>> Session session = hbds.getSessionFactory().openSession();
>>> Transaction tx = session.beginTransaction();
>>> // delete the Meta models from the Hbds
>>> Query query = session.createQuery("from EPackage pa left join
>>> fetch" +
>>> " pa.eClassifiers where pa.e_id= 50");
>>> EPackage delme = (EPackage) query.list().get(0);
>>> // // the following loop is useless but necessary for deleting
>>> // TreeIterator<EObject> it = delme.eAllContents();
>>> // while(it.hasNext()){
>>> // EObject eo = it.next();
>>> // }
>>> session.delete(delme);
>>> // commit and close transaction
>>> tx.commit();
>>> session.close();
>>> }
>>> }
>
>


--

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

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

/**
* <copyright>
*
* Copyright (c) 2005, 2006, 2007 Springsite BV (The Netherlands) and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Martin Taal
* </copyright>
*
* $Id: AnyEObjectType.java,v 1.3 2007/02/08 23:11:37 mtaal Exp $
*/
package org.eclipse.emf.teneo.hibernate.mapping;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.teneo.extension.ExtensionPoint;
import org.hibernate.HibernateException;
import org.hibernate.event.InitializeCollectionEvent;
import org.hibernate.event.def.DefaultInitializeCollectionEventList ener;

/**
* Sets eDeliver to false for the owner of the collection during the initialization of the
* collection.
*
* @author <a href="mailto:mkanaley@tibco.com">Mike Kanaley</a>
*/
public class EMFInitializeCollectionEventListener extends DefaultInitializeCollectionEventListener implements
ExtensionPoint {

private static final long serialVersionUID = 1L;

/*
* (non-Javadoc)
*
* @see org.hibernate.event.def.DefaultInitializeCollectionEventList ener#onInitializeCollection(org.hibernate.event.InitializeCo llectionEvent)
*/
@Override
public void onInitializeCollection(InitializeCollectionEvent event) throws HibernateException {
final Object owner = event.getCollection().getOwner();
boolean setDeliver = false;
boolean eDeliver = false;
EObject eobj = null;
if (owner instanceof EObject) {
eobj = (EObject) owner;
eDeliver = eobj.eDeliver();
try {
// only set to false if it was true
if (eDeliver) {
eobj.eSetDeliver(false);
setDeliver = true;
}
} catch (UnsupportedOperationException e) {
// in this case the eSetDeliver was not overridden from the baseclass
// ignore
}
}
try {
super.onInitializeCollection(event);
} finally {
if (setDeliver) {
eobj.eSetDeliver(eDeliver);
}
}
}
}
--------------090309020007030903060309--
Re: [Teneo]Problems when deleting object [message #608715 is a reply to message #89254] Thu, 12 July 2007 12:32 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

In order to get the libraries to do this modification, I have had to
import from the Teneo cvs repository the project :
- org.eclipse.emf.teneo
- org.eclipse.emf.teneo.annotations

With this It is syntactically correct, but I have had to change :

props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
InheritanceType.SINGLE_TABLE_LITERAL.getName());

in
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
InheritanceType.SINGLE_TABLE.name());

and now I have a new exception at the instruction hbds.initialize()

I obtain this exception :

log4j:WARN No appenders could be found for logger
(org.eclipse.emf.teneo.hibernate.HbHelper).
log4j:WARN Please initialize the log4j system properly.
database test droped
database test created
meta datas tables created
Exception in thread "main" java.lang.NoClassDefFoundError:
org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
at
org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
at test.newtest.teneoMetaModel(newtest.java:180)
at test.newtest.addMetaModel(newtest.java:206)
at test.newtest.main(newtest.java:699)

So I can't test your code.

What must I do to avoid this exception?


thanks for the help,


Guillaume.



Martin Taal wrote:
> It seems that I have found a way to solve this. I needed to add a
> initializecollectioneventlistener to Hibernate. I have attached it. You
> can just create your own initializecollection event listener and copy my
> code into that.
>
> You can the eventlistener as follows.
> After
> hbds.initialize();
>
> you do this:
> final EMFInitializeCollectionEventListener eventListener = new
> EMFInitializeCollectionEventListener();
>
> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>
> new InitializeCollectionEventListener[] { eventListener });
>
>
> this may not be completely syntactically correct as I copied/pasted to
> the post but I think you will get the meaning.
>
> This will be in the next release of Teneo.
>
> Can you let me know if it works for you?
>
> gr. Martin
>
Re: [Teneo]Problems when deleting object [message #608716 is a reply to message #89269] Thu, 12 July 2007 12:39 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Guillaume,
You can just create your own initializecollectioneventlistener and copy the code from the event
listener I sent. Then I don't think you need to do a get latest from cvs (please correct me if I am
wrong).

gr. Martin

doux guillaume wrote:
> Hi again,
>
> In order to get the libraries to do this modification, I have had to
> import from the Teneo cvs repository the project :
> - org.eclipse.emf.teneo
> - org.eclipse.emf.teneo.annotations
>
> With this It is syntactically correct, but I have had to change :
>
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>
> in
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
> InheritanceType.SINGLE_TABLE.name());
>
> and now I have a new exception at the instruction hbds.initialize()
>
> I obtain this exception :
>
> log4j:WARN No appenders could be found for logger
> (org.eclipse.emf.teneo.hibernate.HbHelper).
> log4j:WARN Please initialize the log4j system properly.
> database test droped
> database test created
> meta datas tables created
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
> at
> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>
> at test.newtest.teneoMetaModel(newtest.java:180)
> at test.newtest.addMetaModel(newtest.java:206)
> at test.newtest.main(newtest.java:699)
>
> So I can't test your code.
>
> What must I do to avoid this exception?
>
>
> thanks for the help,
>
>
> Guillaume.
>
>
>
> Martin Taal wrote:
>> It seems that I have found a way to solve this. I needed to add a
>> initializecollectioneventlistener to Hibernate. I have attached it.
>> You can just create your own initializecollection event listener and
>> copy my code into that.
>>
>> You can the eventlistener as follows.
>> After
>> hbds.initialize();
>>
>> you do this:
>> final EMFInitializeCollectionEventListener eventListener = new
>> EMFInitializeCollectionEventListener();
>>
>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>
>> new InitializeCollectionEventListener[] { eventListener });
>>
>>
>> this may not be completely syntactically correct as I copied/pasted to
>> the post but I think you will get the meaning.
>>
>> This will be in the next release of Teneo.
>>
>> Can you let me know if it works for you?
>>
>> gr. Martin
>>


--

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]Problems when deleting object [message #608717 is a reply to message #89284] Thu, 12 July 2007 12:44 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi,

The problem is that I don't have :
org.eclipse.emf.teneo.extension.ExtensionPoint;

and the code you give to me implements ExtensionPoint, that's why I have
import this.


Guillaume

Martin Taal wrote:
> Hi Guillaume,
> You can just create your own initializecollectioneventlistener and copy
> the code from the event listener I sent. Then I don't think you need to
> do a get latest from cvs (please correct me if I am wrong).
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi again,
>>
>> In order to get the libraries to do this modification, I have had to
>> import from the Teneo cvs repository the project :
>> - org.eclipse.emf.teneo
>> - org.eclipse.emf.teneo.annotations
>>
>> With this It is syntactically correct, but I have had to change :
>>
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>
>> in
>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>> InheritanceType.SINGLE_TABLE.name());
>>
>> and now I have a new exception at the instruction hbds.initialize()
>>
>> I obtain this exception :
>>
>> log4j:WARN No appenders could be found for logger
>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>> log4j:WARN Please initialize the log4j system properly.
>> database test droped
>> database test created
>> meta datas tables created
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>> at
>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>
>> at test.newtest.teneoMetaModel(newtest.java:180)
>> at test.newtest.addMetaModel(newtest.java:206)
>> at test.newtest.main(newtest.java:699)
>>
>> So I can't test your code.
>>
>> What must I do to avoid this exception?
>>
>>
>> thanks for the help,
>>
>>
>> Guillaume.
>>
>>
>>
>> Martin Taal wrote:
>>> It seems that I have found a way to solve this. I needed to add a
>>> initializecollectioneventlistener to Hibernate. I have attached it.
>>> You can just create your own initializecollection event listener and
>>> copy my code into that.
>>>
>>> You can the eventlistener as follows.
>>> After
>>> hbds.initialize();
>>>
>>> you do this:
>>> final EMFInitializeCollectionEventListener eventListener =
>>> new EMFInitializeCollectionEventListener();
>>>
>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>
>>> new InitializeCollectionEventListener[] { eventListener });
>>>
>>>
>>> this may not be completely syntactically correct as I copied/pasted
>>> to the post but I think you will get the meaning.
>>>
>>> This will be in the next release of Teneo.
>>>
>>> Can you let me know if it works for you?
>>>
>>> gr. Martin
>>>
>
>
Re: [Teneo]Problems when deleting object [message #608718 is a reply to message #89299] Thu, 12 July 2007 13:31 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

I have try your code without the "implements ExtensionPoint" in
EMFInitializeCollect then I can test it,
but I obtain always my org.hibernate.LazyInitializationException...

Guillaume



doux guillaume wrote:
> Hi,
>
> The problem is that I don't have :
> org.eclipse.emf.teneo.extension.ExtensionPoint;
>
> and the code you give to me implements ExtensionPoint, that's why I have
> import this.
>
>
> Guillaume
>
> Martin Taal wrote:
>> Hi Guillaume,
>> You can just create your own initializecollectioneventlistener and
>> copy the code from the event listener I sent. Then I don't think you
>> need to do a get latest from cvs (please correct me if I am wrong).
>>
>> gr. Martin
>>
>> doux guillaume wrote:
>>> Hi again,
>>>
>>> In order to get the libraries to do this modification, I have had to
>>> import from the Teneo cvs repository the project :
>>> - org.eclipse.emf.teneo
>>> - org.eclipse.emf.teneo.annotations
>>>
>>> With this It is syntactically correct, but I have had to change :
>>>
>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>
>>> in
>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>> InheritanceType.SINGLE_TABLE.name());
>>>
>>> and now I have a new exception at the instruction hbds.initialize()
>>>
>>> I obtain this exception :
>>>
>>> log4j:WARN No appenders could be found for logger
>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>> log4j:WARN Please initialize the log4j system properly.
>>> database test droped
>>> database test created
>>> meta datas tables created
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>
>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>> at test.newtest.addMetaModel(newtest.java:206)
>>> at test.newtest.main(newtest.java:699)
>>>
>>> So I can't test your code.
>>>
>>> What must I do to avoid this exception?
>>>
>>>
>>> thanks for the help,
>>>
>>>
>>> Guillaume.
>>>
>>>
>>>
>>> Martin Taal wrote:
>>>> It seems that I have found a way to solve this. I needed to add a
>>>> initializecollectioneventlistener to Hibernate. I have attached it.
>>>> You can just create your own initializecollection event listener and
>>>> copy my code into that.
>>>>
>>>> You can the eventlistener as follows.
>>>> After
>>>> hbds.initialize();
>>>>
>>>> you do this:
>>>> final EMFInitializeCollectionEventListener eventListener =
>>>> new EMFInitializeCollectionEventListener();
>>>>
>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>
>>>> new InitializeCollectionEventListener[] { eventListener });
>>>>
>>>>
>>>> this may not be completely syntactically correct as I copied/pasted
>>>> to the post but I think you will get the meaning.
>>>>
>>>> This will be in the next release of Teneo.
>>>>
>>>> Can you let me know if it works for you?
>>>>
>>>> gr. Martin
>>>>
>>
>>
Re: [Teneo]Problems when deleting object [message #608719 is a reply to message #89314] Thu, 12 July 2007 13:50 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Forgot this, because the event listener is set after the hbds.initialize() you have to get a new
sessionFactory.

SessionFactory sf = ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
Session session = sf.getSessionFactory().openSession();
and then do the rest...

gr. Martin

doux guillaume wrote:
> Hi again,
>
> I have try your code without the "implements ExtensionPoint" in
> EMFInitializeCollect then I can test it,
> but I obtain always my org.hibernate.LazyInitializationException...
>
> Guillaume
>
>
>
> doux guillaume wrote:
>> Hi,
>>
>> The problem is that I don't have :
>> org.eclipse.emf.teneo.extension.ExtensionPoint;
>>
>> and the code you give to me implements ExtensionPoint, that's why I
>> have import this.
>>
>>
>> Guillaume
>>
>> Martin Taal wrote:
>>> Hi Guillaume,
>>> You can just create your own initializecollectioneventlistener and
>>> copy the code from the event listener I sent. Then I don't think you
>>> need to do a get latest from cvs (please correct me if I am wrong).
>>>
>>> gr. Martin
>>>
>>> doux guillaume wrote:
>>>> Hi again,
>>>>
>>>> In order to get the libraries to do this modification, I have had to
>>>> import from the Teneo cvs repository the project :
>>>> - org.eclipse.emf.teneo
>>>> - org.eclipse.emf.teneo.annotations
>>>>
>>>> With this It is syntactically correct, but I have had to change :
>>>>
>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>>
>>>> in
>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>> InheritanceType.SINGLE_TABLE.name());
>>>>
>>>> and now I have a new exception at the instruction hbds.initialize()
>>>>
>>>> I obtain this exception :
>>>>
>>>> log4j:WARN No appenders could be found for logger
>>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>>> log4j:WARN Please initialize the log4j system properly.
>>>> database test droped
>>>> database test created
>>>> meta datas tables created
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>>
>>>> at
>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>>
>>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>>> at test.newtest.addMetaModel(newtest.java:206)
>>>> at test.newtest.main(newtest.java:699)
>>>>
>>>> So I can't test your code.
>>>>
>>>> What must I do to avoid this exception?
>>>>
>>>>
>>>> thanks for the help,
>>>>
>>>>
>>>> Guillaume.
>>>>
>>>>
>>>>
>>>> Martin Taal wrote:
>>>>> It seems that I have found a way to solve this. I needed to add a
>>>>> initializecollectioneventlistener to Hibernate. I have attached it.
>>>>> You can just create your own initializecollection event listener
>>>>> and copy my code into that.
>>>>>
>>>>> You can the eventlistener as follows.
>>>>> After
>>>>> hbds.initialize();
>>>>>
>>>>> you do this:
>>>>> final EMFInitializeCollectionEventListener eventListener =
>>>>> new EMFInitializeCollectionEventListener();
>>>>>
>>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>>
>>>>> new InitializeCollectionEventListener[] { eventListener
>>>>> });
>>>>>
>>>>>
>>>>> this may not be completely syntactically correct as I copied/pasted
>>>>> to the post but I think you will get the meaning.
>>>>>
>>>>> This will be in the next release of Teneo.
>>>>>
>>>>> Can you let me know if it works for you?
>>>>>
>>>>> gr. Martin
>>>>>
>>>
>>>


--

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]Problems when deleting object [message #608721 is a reply to message #89329] Thu, 12 July 2007 14:00 Go to previous message
Eclipse UserFriend
Originally posted by: doux.guil.gmail.com

Hi again,

I have done this :

SessionFactory sf =
((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
Session session = sf.openSession();

And then it works.

Thanks a lot !

Guillaume


Martin Taal wrote:
> Forgot this, because the event listener is set after the
> hbds.initialize() you have to get a new sessionFactory.
>
> SessionFactory sf =
> ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
> Session session = sf.getSessionFactory().openSession();
> and then do the rest...
>
> gr. Martin
>
> doux guillaume wrote:
>> Hi again,
>>
>> I have try your code without the "implements ExtensionPoint" in
>> EMFInitializeCollect then I can test it,
>> but I obtain always my org.hibernate.LazyInitializationException...
>>
>> Guillaume
>>
>>
>>
>> doux guillaume wrote:
>>> Hi,
>>>
>>> The problem is that I don't have :
>>> org.eclipse.emf.teneo.extension.ExtensionPoint;
>>>
>>> and the code you give to me implements ExtensionPoint, that's why I
>>> have import this.
>>>
>>>
>>> Guillaume
>>>
>>> Martin Taal wrote:
>>>> Hi Guillaume,
>>>> You can just create your own initializecollectioneventlistener and
>>>> copy the code from the event listener I sent. Then I don't think you
>>>> need to do a get latest from cvs (please correct me if I am wrong).
>>>>
>>>> gr. Martin
>>>>
>>>> doux guillaume wrote:
>>>>> Hi again,
>>>>>
>>>>> In order to get the libraries to do this modification, I have had
>>>>> to import from the Teneo cvs repository the project :
>>>>> - org.eclipse.emf.teneo
>>>>> - org.eclipse.emf.teneo.annotations
>>>>>
>>>>> With this It is syntactically correct, but I have had to change :
>>>>>
>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>>>
>>>>> in
>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>> InheritanceType.SINGLE_TABLE.name());
>>>>>
>>>>> and now I have a new exception at the instruction hbds.initialize()
>>>>>
>>>>> I obtain this exception :
>>>>>
>>>>> log4j:WARN No appenders could be found for logger
>>>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>>>> log4j:WARN Please initialize the log4j system properly.
>>>>> database test droped
>>>>> database test created
>>>>> meta datas tables created
>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>>>
>>>>> at
>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>>>
>>>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>>>> at test.newtest.addMetaModel(newtest.java:206)
>>>>> at test.newtest.main(newtest.java:699)
>>>>>
>>>>> So I can't test your code.
>>>>>
>>>>> What must I do to avoid this exception?
>>>>>
>>>>>
>>>>> thanks for the help,
>>>>>
>>>>>
>>>>> Guillaume.
>>>>>
>>>>>
>>>>>
>>>>> Martin Taal wrote:
>>>>>> It seems that I have found a way to solve this. I needed to add a
>>>>>> initializecollectioneventlistener to Hibernate. I have attached
>>>>>> it. You can just create your own initializecollection event
>>>>>> listener and copy my code into that.
>>>>>>
>>>>>> You can the eventlistener as follows.
>>>>>> After
>>>>>> hbds.initialize();
>>>>>>
>>>>>> you do this:
>>>>>> final EMFInitializeCollectionEventListener eventListener =
>>>>>> new EMFInitializeCollectionEventListener();
>>>>>>
>>>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>>>
>>>>>> new InitializeCollectionEventListener[] {
>>>>>> eventListener });
>>>>>>
>>>>>>
>>>>>> this may not be completely syntactically correct as I
>>>>>> copied/pasted to the post but I think you will get the meaning.
>>>>>>
>>>>>> This will be in the next release of Teneo.
>>>>>>
>>>>>> Can you let me know if it works for you?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>
>>>>
>
>
H
Re: [Teneo]Problems when deleting object [message #608722 is a reply to message #89364] Thu, 12 July 2007 14:06 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Okay great, in the next release of Teneo you won't have to do the extre buildSessionFactory anymore
then the eventlistener will be set as part of the initialization step of the datastore.

gr. Martin

doux guillaume wrote:
> Hi again,
>
> I have done this :
>
> SessionFactory sf =
> ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
> Session session = sf.openSession();
>
> And then it works.
>
> Thanks a lot !
>
> Guillaume
>
>
> Martin Taal wrote:
>> Forgot this, because the event listener is set after the
>> hbds.initialize() you have to get a new sessionFactory.
>>
>> SessionFactory sf =
>> ((HbSessionDataStore)hbds).getConfiguration().buildSessionFa ctory();
>> Session session = sf.getSessionFactory().openSession();
>> and then do the rest...
>>
>> gr. Martin
>>
>> doux guillaume wrote:
>>> Hi again,
>>>
>>> I have try your code without the "implements ExtensionPoint" in
>>> EMFInitializeCollect then I can test it,
>>> but I obtain always my org.hibernate.LazyInitializationException...
>>>
>>> Guillaume
>>>
>>>
>>>
>>> doux guillaume wrote:
>>>> Hi,
>>>>
>>>> The problem is that I don't have :
>>>> org.eclipse.emf.teneo.extension.ExtensionPoint;
>>>>
>>>> and the code you give to me implements ExtensionPoint, that's why I
>>>> have import this.
>>>>
>>>>
>>>> Guillaume
>>>>
>>>> Martin Taal wrote:
>>>>> Hi Guillaume,
>>>>> You can just create your own initializecollectioneventlistener and
>>>>> copy the code from the event listener I sent. Then I don't think
>>>>> you need to do a get latest from cvs (please correct me if I am
>>>>> wrong).
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> doux guillaume wrote:
>>>>>> Hi again,
>>>>>>
>>>>>> In order to get the libraries to do this modification, I have had
>>>>>> to import from the Teneo cvs repository the project :
>>>>>> - org.eclipse.emf.teneo
>>>>>> - org.eclipse.emf.teneo.annotations
>>>>>>
>>>>>> With this It is syntactically correct, but I have had to change :
>>>>>>
>>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>>> InheritanceType.SINGLE_TABLE_LITERAL.getName());
>>>>>>
>>>>>> in
>>>>>> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
>>>>>> InheritanceType.SINGLE_TABLE.name());
>>>>>>
>>>>>> and now I have a new exception at the instruction hbds.initialize()
>>>>>>
>>>>>> I obtain this exception :
>>>>>>
>>>>>> log4j:WARN No appenders could be found for logger
>>>>>> (org.eclipse.emf.teneo.hibernate.HbHelper).
>>>>>> log4j:WARN Please initialize the log4j system properly.
>>>>>> database test droped
>>>>>> database test created
>>>>>> meta datas tables created
>>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>>> org/eclipse/emf/teneo/annotations/pamodel/util/BasicPamodelB uilder
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbDataStore.mapEPackages(HbD ataStore.java:531)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.mapModel( HbSessionDataStore.java:149)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:70)
>>>>>>
>>>>>> at test.newtest.teneoMetaModel(newtest.java:180)
>>>>>> at test.newtest.addMetaModel(newtest.java:206)
>>>>>> at test.newtest.main(newtest.java:699)
>>>>>>
>>>>>> So I can't test your code.
>>>>>>
>>>>>> What must I do to avoid this exception?
>>>>>>
>>>>>>
>>>>>> thanks for the help,
>>>>>>
>>>>>>
>>>>>> Guillaume.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martin Taal wrote:
>>>>>>> It seems that I have found a way to solve this. I needed to add a
>>>>>>> initializecollectioneventlistener to Hibernate. I have attached
>>>>>>> it. You can just create your own initializecollection event
>>>>>>> listener and copy my code into that.
>>>>>>>
>>>>>>> You can the eventlistener as follows.
>>>>>>> After
>>>>>>> hbds.initialize();
>>>>>>>
>>>>>>> you do this:
>>>>>>> final EMFInitializeCollectionEventListener eventListener
>>>>>>> = new EMFInitializeCollectionEventListener();
>>>>>>>
>>>>>>> ((HbSessionDataStore)hbds.getConfiguration().getEventListene rs().setInitializeCollectionEventListeners(
>>>>>>>
>>>>>>> new InitializeCollectionEventListener[] {
>>>>>>> eventListener });
>>>>>>>
>>>>>>>
>>>>>>> this may not be completely syntactically correct as I
>>>>>>> copied/pasted to the post but I think you will get the meaning.
>>>>>>>
>>>>>>> This will be in the next release of Teneo.
>>>>>>>
>>>>>>> Can you let me know if it works for you?
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>
>>>>>
>>
>>
> H


--

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:[EMF Compare] XSLT File
Next Topic:[Teneo] another problems: my datas are modified by Teneo
Goto Forum:
  


Current Time: Tue Oct 04 01:59:32 GMT 2022

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

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

Back to the top