Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Unload() questions
[Teneo] Unload() questions [message #117967] Sat, 12 April 2008 16:04 Go to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

I have a question concerning the unload() function. When I started to work
with Teneo, I put the GMF model into the hibernate database as you did in
your GMF tutorial. I had some "java.lang.IllegalStateException: Cannot
modify resource set without a write transaction" notes in the .log file
during unload, so I put an EMF transaction and a Hibernate transaction
around the unload() statement in
XxxDocumentProvider$ResourceSetInfo.dispose(). The exceptions in .log
where gone.

Now I decided to go a step back and use the XML representation of the GMF
model, leaving the logical model in the hibernate database. (In fact I put
the XML representation in a blob field of the database. I wrote a special
URL handling in the way I had seen in Teneo to manage that.)

But then I discoverd that the model storage seemed to behave in an
unpredictable way: sometimes objects vanished from the model after storing
and reloading. I found out that hibernate deleted objects during the
unload of the resource because they had been marked as orphaned. Every
child object that had been loaded from the database was deleted; newly
created child objects were stored in the database. The reason for this I
don't know exactly but I think the clearing of the resource contents has
something to do with it and the splitting of the resource types. Just to
be shure that my URL handling is not buggy I changed it to a real file URL
for the GMF model. The problems were the same.

So I changed the XxxDocumentProvider$ResourceSetInfo.dispose() back to its
original. Now the database problems are gone but the "Cannot modify
resource set.." exception is again in the .log file.

I manage the hibernate session with one session controller. I have no open
transactions when the application is closed. All database storage actions
are done in the doSave() method. So I expect the unload() function to do
nothing on the database.

These are my questions:
What database actions are expected to be done during unload()?
Should there be an EMF and hibernate transaction open?
Do I have to do something special during unload with my two resource type,
e.g. unloading them in a special sequence? (I had to do this in doSave()
to ensure that the primary keys are set when I store the XML GMF resource)

Best regards
Manfred
Re: [Teneo] Unload() questions [message #117994 is a reply to message #117967] Sat, 12 April 2008 20:43 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
Fmi, which version of Teneo are you using?

The unload clears the resource but it should not result in any database actions. During the clear of
the resource contents the detached method is called which calls detachedHelper which calls
removedEObject. However these methods don't do much more than putting the objects in the
deletedObjects array and removing them from the newobjects/loadedobjects arrays. As long as save is
not called this should not result in actually removing the objects from the db. What you can do is
enabled hibernate logging and see if hibernate logs any actions during the unload.
Can you let me know what you find here?

To fight the symptom what you can do is set the hibernate flushmode to commit. So then hibernate
will only flush changes to the db when you call an explicit commit on the transaction. But this will
only solve the symptom and not the underlying cause...

I can imagine that you need to save the hibernate resource before the separate gmf xml resource
because otherwise the references from the gmf resource to the (hibernate) objects can't use the
primary keys.

Note a difference between your approach and the approach in the teneo-gmf tutorial is that in the
tutorial I use one resource for both the diagram and the model data.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> I have a question concerning the unload() function. When I started to
> work with Teneo, I put the GMF model into the hibernate database as you
> did in your GMF tutorial. I had some "java.lang.IllegalStateException:
> Cannot modify resource set without a write transaction" notes in the
> .log file during unload, so I put an EMF transaction and a Hibernate
> transaction around the unload() statement in
> XxxDocumentProvider$ResourceSetInfo.dispose(). The exceptions in .log
> where gone.
>
> Now I decided to go a step back and use the XML representation of the
> GMF model, leaving the logical model in the hibernate database. (In fact
> I put the XML representation in a blob field of the database. I wrote a
> special URL handling in the way I had seen in Teneo to manage that.)
> But then I discoverd that the model storage seemed to behave in an
> unpredictable way: sometimes objects vanished from the model after
> storing and reloading. I found out that hibernate deleted objects during
> the unload of the resource because they had been marked as orphaned.
> Every child object that had been loaded from the database was deleted;
> newly created child objects were stored in the database. The reason for
> this I don't know exactly but I think the clearing of the resource
> contents has something to do with it and the splitting of the resource
> types. Just to be shure that my URL handling is not buggy I changed it
> to a real file URL for the GMF model. The problems were the same.
>
> So I changed the XxxDocumentProvider$ResourceSetInfo.dispose() back to
> its original. Now the database problems are gone but the "Cannot modify
> resource set.." exception is again in the .log file.
>
> I manage the hibernate session with one session controller. I have no
> open transactions when the application is closed. All database storage
> actions are done in the doSave() method. So I expect the unload()
> function to do nothing on the database.
>
> These are my questions: What database actions are expected to be done
> during unload()? Should there be an EMF and hibernate transaction open?
> Do I have to do something special during unload with my two resource
> type, e.g. unloading them in a special sequence? (I had to do this in
> doSave() to ensure that the primary keys are set when I store the XML
> GMF resource)
>
> Best regards
> Manfred
>
>


--

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] Unload() questions [message #118295 is a reply to message #117994] Mon, 14 April 2008 11:29 Go to previous messageGo to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

my Teneo version is 0.8.0.v200804061007

In the meantime I have a solution, but no understanding..;-)

This is the scenario:
Loading of a model with one root object and one child. (And another root
object in another resource, to be honest)
Storing the model with "save" (without any previous or later changes).
Closing the program.

When I have the original dispose() method, the unload does a .log entry:

!MESSAGE Cannot modify resource set without a write transaction
!STACK 0
java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:322)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:266)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:222)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
at
org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1030)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.clear(N otifyingListImpl.java:1101)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(Re sourceImpl.java:1472)
at
org.eclipse.emf.teneo.resource.StoreResource.doUnload(StoreR esource.java:370)
at
org.eclipse.emf.teneo.hibernate.resource.HibernateResource.d oUnload(HibernateResource.java:410)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(Reso urceImpl.java:1494)
at
de.edvchl.clic.workflow.diagram.part.WorkflowDocumentProvide r$ResourceSetInfo.dispose(WorkflowDocumentProvider.java:732)


So I changed the dispose() function like this:

public void dispose() {
getResourceSet().eAdapters().remove(myResourceSetListener);
TransactionalEditingDomain editingDomain = getEditingDomain();
final EditingDomainHandler handler =
EditingDomainHandler.getEditingDomainHandler();
Command cmd = new RecordingCommand(editingDomain){

@Override
protected void doExecute() {
handler.getSessionController().getSessionWrapper().beginTran saction();
try {
for (Resource resource : getResourceSet().getResources()) {
resource.unload();
}
handler.getSessionController().getSessionWrapper().commitTra nsaction();
}
catch (RuntimeException e) {
handler.getSessionController().getSessionWrapper().rollbackT ransaction();
throw e;
}
}

};
editingDomain.getCommandStack().execute(cmd);
}


(The handler is just a simple helper class to get always the one and only
SessionController)

The unload() has no more Exceptions, but the log4j-log shows:
136736 [main] DEBUG
org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
unload, has session controller, sessioncontroller is therefor responsible
for session close
136746 [main] DEBUG
org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
unload, has session controller, sessioncontroller is therefor responsible
for session close
136746 [main] DEBUG org.hibernate.transaction.JDBCTransaction - commit
136746 [main] DEBUG org.hibernate.impl.SessionImpl - automatically
flushing session
136746 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener
- flushing session
136746 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener
- processing flush-time cascades
136746 [main] DEBUG org.hibernate.engine.Cascade - processing cascade
ACTION_SAVE_UPDATE for: Prozess
136746 [main] DEBUG org.hibernate.engine.Cascade - cascade
ACTION_SAVE_UPDATE for collection: Prozess.elemente
136746 [main] DEBUG org.hibernate.engine.Cascade - done cascade
ACTION_SAVE_UPDATE for collection: Prozess.elemente
136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphans for
collection: Prozess.elemente
136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphaned
entity instance: ProzessElement
136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener -
deleting a persistent instance
136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener -
deleting [Aktivitaet#402884e9194c8ec501194c90f7fe0004]


So my only child object has been deleted!

My solution is, to do an EMF transaction without a hibernate transaction.
Then everything is ok, no more exception and no deletes.

What is wrong with the hibernate transaction?
The previous save shows a clean flush without any changes in the database.

gr. Manfred
Re: [Teneo] Unload() questions [message #118333 is a reply to message #118295] Mon, 14 April 2008 17:58 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
It seems that the unload removes the child from the parent collection. To be sure can you try/check
the following:
- is the child present in the collection before the unload?
- is the child present in the collection after the unload but before the commit?

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> my Teneo version is 0.8.0.v200804061007
>
> In the meantime I have a solution, but no understanding..;-)
>
> This is the scenario:
> Loading of a model with one root object and one child. (And another root
> object in another resource, to be honest)
> Storing the model with "save" (without any previous or later changes).
> Closing the program.
>
> When I have the original dispose() method, the unload does a .log entry:
>
> !MESSAGE Cannot modify resource set without a write transaction
> !STACK 0
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:322)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:284)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:266)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:222)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
>
> at
> org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1030)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.clear(N otifyingListImpl.java:1101)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(Re sourceImpl.java:1472)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.doUnload(StoreR esource.java:370)
>
> at
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.d oUnload(HibernateResource.java:410)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(Reso urceImpl.java:1494)
>
> at
> de.edvchl.clic.workflow.diagram.part.WorkflowDocumentProvide r$ResourceSetInfo.dispose(WorkflowDocumentProvider.java:732)
>
>
>
> So I changed the dispose() function like this:
>
> public void dispose() {
> getResourceSet().eAdapters().remove(myResourceSetListener);
> TransactionalEditingDomain editingDomain = getEditingDomain();
> final EditingDomainHandler handler =
> EditingDomainHandler.getEditingDomainHandler();
> Command cmd = new RecordingCommand(editingDomain){
>
> @Override
> protected void doExecute() {
>
> handler.getSessionController().getSessionWrapper().beginTran saction();
> try {
> for (Resource resource :
> getResourceSet().getResources()) {
> resource.unload();
> }
>
> handler.getSessionController().getSessionWrapper().commitTra nsaction();
> }
> catch (RuntimeException e) {
>
> handler.getSessionController().getSessionWrapper().rollbackT ransaction();
> throw e;
> }
> }
>
> };
> editingDomain.getCommandStack().execute(cmd);
> }
>
>
> (The handler is just a simple helper class to get always the one and
> only SessionController)
>
> The unload() has no more Exceptions, but the log4j-log shows:
> 136736 [main] DEBUG
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
> unload, has session controller, sessioncontroller is therefor
> responsible for session close
> 136746 [main] DEBUG
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
> unload, has session controller, sessioncontroller is therefor
> responsible for session close
> 136746 [main] DEBUG org.hibernate.transaction.JDBCTransaction - commit
> 136746 [main] DEBUG org.hibernate.impl.SessionImpl - automatically
> flushing session
> 136746 [main] DEBUG
> org.hibernate.event.def.AbstractFlushingEventListener - flushing session
> 136746 [main] DEBUG
> org.hibernate.event.def.AbstractFlushingEventListener - processing
> flush-time cascades
> 136746 [main] DEBUG org.hibernate.engine.Cascade - processing cascade
> ACTION_SAVE_UPDATE for: Prozess
> 136746 [main] DEBUG org.hibernate.engine.Cascade - cascade
> ACTION_SAVE_UPDATE for collection: Prozess.elemente
> 136746 [main] DEBUG org.hibernate.engine.Cascade - done cascade
> ACTION_SAVE_UPDATE for collection: Prozess.elemente
> 136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphans for
> collection: Prozess.elemente
> 136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphaned
> entity instance: ProzessElement
> 136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener
> - deleting a persistent instance
> 136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener
> - deleting [Aktivitaet#402884e9194c8ec501194c90f7fe0004]
>
>
> So my only child object has been deleted!
>
> My solution is, to do an EMF transaction without a hibernate transaction.
> Then everything is ok, no more exception and no deletes.
>
> What is wrong with the hibernate transaction?
> The previous save shows a clean flush without any changes in the database.
>
> gr. Manfred
>


--

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] Unload() questions [message #118368 is a reply to message #118333] Tue, 15 April 2008 06:54 Go to previous messageGo to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

yes, you are right! Before the unload everything is ok, but after the
unload the resource is empty (I expected this) and the model root element
has lost its child (I didn't expect this).
Is there a chain of events / event listeners that do this change during
the clearing of the resource contents list?

gr. Manfred
Re: [Teneo] Unload() questions [message #118377 is a reply to message #118368] Tue, 15 April 2008 08:30 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
I tested the unload and in my case the children remain in the parent (I tested using the
Library/Book/Writer example). In your case I don't know which eventlistener causes the remove of the
child. So the only option is to debug through the unload action and see what happens.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> yes, you are right! Before the unload everything is ok, but after the
> unload the resource is empty (I expected this) and the model root
> element has lost its child (I didn't expect this).
> Is there a chain of events / event listeners that do this change during
> the clearing of the resource contents list?
>
> gr. Manfred
>


--

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] Unload() questions [message #118391 is a reply to message #118377] Tue, 15 April 2008 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Martin,

I know solve folks specialize the unload behavior to decompose the
containment structure of the unloaded tree of objects. That's not the
default behavior though...


Martin Taal wrote:
> Hi Manfred,
> I tested the unload and in my case the children remain in the parent
> (I tested using the Library/Book/Writer example). In your case I don't
> know which eventlistener causes the remove of the child. So the only
> option is to debug through the unload action and see what happens.
>
> gr. Martin
>
> Manfred Hahn wrote:
>> Hi Martin,
>>
>> yes, you are right! Before the unload everything is ok, but after the
>> unload the resource is empty (I expected this) and the model root
>> element has lost its child (I didn't expect this).
>> Is there a chain of events / event listeners that do this change
>> during the clearing of the resource contents list?
>>
>> gr. Manfred
>>
>
>
Re: [Teneo] Unload() questions [message #118415 is a reply to message #118377] Tue, 15 April 2008 15:01 Go to previous messageGo to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

I've debugged the unload() and came to the following stack:
ProzessImpl.eInverseRemove(InternalEObject, int, NotificationChain) line:
245
ProzessImpl(BasicEObjectImpl).eInverseRemove(InternalEObject , int,
Class<?>, NotificationChain) line: 1421
AktivitaetImpl(ProzessElementImpl).eBasicRemoveFromContainer Feature(NotificationChain)
line: 252
AktivitaetImpl(BasicEObjectImpl).eBasicRemoveFromContainer(N otificationChain)
line: 1366
AktivitaetImpl(BasicEObjectImpl).eSetResource(Resource$Inter nal,
NotificationChain) line: 972
ResourceImpl$ContentsEList<E>.inverseRemove(E, NotificationChain) line: 386
ResourceImpl$ContentsEList<E>(NotifyingListImpl<E>).clear() line: 1092
HibernateResource(ResourceImpl).doUnload() line: 1472
HibernateResource(StoreResource).doUnload() line: 370
HibernateResource.doUnload() line: 410
HibernateResource(ResourceImpl).unload() line: 1494

This is because the resource.contents has not only the root object
(ProzessImpl) in its data list but also the child object (AktivitaetImpl).
I noticed that before but did not realize that this could be wrong. I
thought the data list would contain all objects. But it is wrong, isn't it?

I fear that the problem we discussed here

http://www.eclipse.org/newsportal/article.php?id=4805&gr oup=eclipse.technology.emft#4805

comes back in a new flavour. I did not verify this but I guess the loading
of the xml diagram resource puts the child object as another root object
into the resource. I'll debug it as soon as possible, but it could last a
few days ...

gr. Manfred
Re: [Teneo] Unload() questions [message #118658 is a reply to message #118415] Wed, 16 April 2008 07:26 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
Yes the clear and resulting remove from the container seems standard EMF and correct behavior if the
objects are in the root of the resource.
The question is how the object ended up in the root of the resource. If you debug then a good place
to put a breakpoint is in the attached* methods in the StoreResource. These are called when a new
object is added to the resource.

As a side remark.
Even if, in your case, there is an underlying solvable issue, then it is possible with a
hibernateresource to load parents and childs in the top of the resource. This can be done using
queries. In that case the same side-effect will occur. So afaics a hibernateresource should be
changed to do clear without any inverseremovals.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> I've debugged the unload() and came to the following stack:
> ProzessImpl.eInverseRemove(InternalEObject, int, NotificationChain)
> line: 245
> ProzessImpl(BasicEObjectImpl).eInverseRemove(InternalEObject , int,
> Class<?>, NotificationChain) line: 1421
> AktivitaetImpl(ProzessElementImpl).eBasicRemoveFromContainer Feature(NotificationChain)
> line: 252
> AktivitaetImpl(BasicEObjectImpl).eBasicRemoveFromContainer(N otificationChain)
> line: 1366
> AktivitaetImpl(BasicEObjectImpl).eSetResource(Resource$Inter nal,
> NotificationChain) line: 972
> ResourceImpl$ContentsEList<E>.inverseRemove(E, NotificationChain) line:
> 386
> ResourceImpl$ContentsEList<E>(NotifyingListImpl<E>).clear() line: 1092
> HibernateResource(ResourceImpl).doUnload() line: 1472
> HibernateResource(StoreResource).doUnload() line: 370
> HibernateResource.doUnload() line: 410
> HibernateResource(ResourceImpl).unload() line: 1494
>
> This is because the resource.contents has not only the root object
> (ProzessImpl) in its data list but also the child object
> (AktivitaetImpl). I noticed that before but did not realize that this
> could be wrong. I thought the data list would contain all objects. But
> it is wrong, isn't it?
>
> I fear that the problem we discussed here
>
> http://www.eclipse.org/newsportal/article.php?id=4805&gr oup=eclipse.technology.emft#4805
>
>
> comes back in a new flavour. I did not verify this but I guess the
> loading of the xml diagram resource puts the child object as another
> root object into the resource. I'll debug it as soon as possible, but it
> could last a few days ...
>
> gr. Manfred
>


--

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] Unload() questions [message #119260 is a reply to message #118658] Sat, 19 April 2008 19:28 Go to previous messageGo to next message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

I think I have found a reason for the existence of the child object in the
resource contents.

In my xml file (or BLOB) is a line like this

<element
href="hibernate://?sessionController=sessioncontroller&amp;query1=FROM
de.edvchl.clic.workflow.Prozess where bezeichnung =
'test'&amp;loadStrategy=addToContents#Aktivitaet|id=ff80 80811967bfab011967c022f10004 "/>

with the reference to my child model object.

During load of the xml source the reference is resolved and it ends up in
HibernateResouce.geEObjectByID().
The interesting thing is that the param id has the value
"Aktivitaet|id=ff8080811967bfab011967c022f10004"!
This has the effect that the object is not found with the firstCheck
though it had been loaded before and the id
"ff8080811967bfab011967c022f10004" is in the map.
Then the object is loaded from the session cache and added to the contents
as if it were a root object.

Another interesting hint:
inside addToContents there is an exception thrown somewhere in
notifications.dispatch();
this leads to a resourceSet.getEObject(proxyURI, false) in EcoreUtil line
203
I cannot see the exception in debug mode - I assume the compiler
optimized it away because it is not used.

During unload() the child object is always deleted when I do it inside of
a hibernate transaction.

Should I try to manipulate the id by overwriting
HibernateResource.getEObjectID() or is this an interesting feature for
everyone that should be done in the Teneo project?

gr. Manfred
Re: [Teneo] Unload() questions [message #119324 is a reply to message #119260] Sun, 20 April 2008 10:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
Afaics the getObjectById should also try to find it using the real id (the part after the |). So
this is a bug (or missing feature). Can you enter a bugzilla for this?
I will solve this in the coming build (within a few days).

In addition I think that the getObjectById method should not call addToContents but the
addToContentOrAttach method. I am reworking this addToContentOrAttach method currently.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> I think I have found a reason for the existence of the child object in
> the resource contents.
>
> In my xml file (or BLOB) is a line like this
>
> <element
> href="hibernate://?sessionController=sessioncontroller&amp;query1=FROM
> de.edvchl.clic.workflow.Prozess where bezeichnung =
> 'test'&amp;loadStrategy=addToContents#Aktivitaet|id=ff80 80811967bfab011967c022f10004 "/>
>
>
> with the reference to my child model object.
>
> During load of the xml source the reference is resolved and it ends up
> in HibernateResouce.geEObjectByID().
> The interesting thing is that the param id has the value
> "Aktivitaet|id=ff8080811967bfab011967c022f10004"!
> This has the effect that the object is not found with the firstCheck
> though it had been loaded before and the id
> "ff8080811967bfab011967c022f10004" is in the map. Then the object is
> loaded from the session cache and added to the contents as if it were a
> root object.
>
> Another interesting hint:
> inside addToContents there is an exception thrown somewhere in
> notifications.dispatch();
> this leads to a resourceSet.getEObject(proxyURI, false) in EcoreUtil
> line 203
> I cannot see the exception in debug mode - I assume the compiler
> optimized it away because it is not used.
>
> During unload() the child object is always deleted when I do it inside
> of a hibernate transaction.
>
> Should I try to manipulate the id by overwriting
> HibernateResource.getEObjectID() or is this an interesting feature for
> everyone that should be done in the Teneo project?
>
> gr. Manfred
>


--

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] Unload() questions [message #616234 is a reply to message #117967] Sat, 12 April 2008 20:43 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
Fmi, which version of Teneo are you using?

The unload clears the resource but it should not result in any database actions. During the clear of
the resource contents the detached method is called which calls detachedHelper which calls
removedEObject. However these methods don't do much more than putting the objects in the
deletedObjects array and removing them from the newobjects/loadedobjects arrays. As long as save is
not called this should not result in actually removing the objects from the db. What you can do is
enabled hibernate logging and see if hibernate logs any actions during the unload.
Can you let me know what you find here?

To fight the symptom what you can do is set the hibernate flushmode to commit. So then hibernate
will only flush changes to the db when you call an explicit commit on the transaction. But this will
only solve the symptom and not the underlying cause...

I can imagine that you need to save the hibernate resource before the separate gmf xml resource
because otherwise the references from the gmf resource to the (hibernate) objects can't use the
primary keys.

Note a difference between your approach and the approach in the teneo-gmf tutorial is that in the
tutorial I use one resource for both the diagram and the model data.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> I have a question concerning the unload() function. When I started to
> work with Teneo, I put the GMF model into the hibernate database as you
> did in your GMF tutorial. I had some "java.lang.IllegalStateException:
> Cannot modify resource set without a write transaction" notes in the
> .log file during unload, so I put an EMF transaction and a Hibernate
> transaction around the unload() statement in
> XxxDocumentProvider$ResourceSetInfo.dispose(). The exceptions in .log
> where gone.
>
> Now I decided to go a step back and use the XML representation of the
> GMF model, leaving the logical model in the hibernate database. (In fact
> I put the XML representation in a blob field of the database. I wrote a
> special URL handling in the way I had seen in Teneo to manage that.)
> But then I discoverd that the model storage seemed to behave in an
> unpredictable way: sometimes objects vanished from the model after
> storing and reloading. I found out that hibernate deleted objects during
> the unload of the resource because they had been marked as orphaned.
> Every child object that had been loaded from the database was deleted;
> newly created child objects were stored in the database. The reason for
> this I don't know exactly but I think the clearing of the resource
> contents has something to do with it and the splitting of the resource
> types. Just to be shure that my URL handling is not buggy I changed it
> to a real file URL for the GMF model. The problems were the same.
>
> So I changed the XxxDocumentProvider$ResourceSetInfo.dispose() back to
> its original. Now the database problems are gone but the "Cannot modify
> resource set.." exception is again in the .log file.
>
> I manage the hibernate session with one session controller. I have no
> open transactions when the application is closed. All database storage
> actions are done in the doSave() method. So I expect the unload()
> function to do nothing on the database.
>
> These are my questions: What database actions are expected to be done
> during unload()? Should there be an EMF and hibernate transaction open?
> Do I have to do something special during unload with my two resource
> type, e.g. unloading them in a special sequence? (I had to do this in
> doSave() to ensure that the primary keys are set when I store the XML
> GMF resource)
>
> Best regards
> Manfred
>
>


--

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] Unload() questions [message #616287 is a reply to message #117994] Mon, 14 April 2008 11:29 Go to previous message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

my Teneo version is 0.8.0.v200804061007

In the meantime I have a solution, but no understanding..;-)

This is the scenario:
Loading of a model with one root object and one child. (And another root
object in another resource, to be honest)
Storing the model with "save" (without any previous or later changes).
Closing the program.

When I have the original dispose() method, the unload does a .log entry:

!MESSAGE Cannot modify resource set without a write transaction
!STACK 0
java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:322)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:266)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:222)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
at
org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1030)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.clear(N otifyingListImpl.java:1101)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(Re sourceImpl.java:1472)
at
org.eclipse.emf.teneo.resource.StoreResource.doUnload(StoreR esource.java:370)
at
org.eclipse.emf.teneo.hibernate.resource.HibernateResource.d oUnload(HibernateResource.java:410)
at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(Reso urceImpl.java:1494)
at
de.edvchl.clic.workflow.diagram.part.WorkflowDocumentProvide r$ResourceSetInfo.dispose(WorkflowDocumentProvider.java:732)


So I changed the dispose() function like this:

public void dispose() {
getResourceSet().eAdapters().remove(myResourceSetListener);
TransactionalEditingDomain editingDomain = getEditingDomain();
final EditingDomainHandler handler =
EditingDomainHandler.getEditingDomainHandler();
Command cmd = new RecordingCommand(editingDomain){

@Override
protected void doExecute() {
handler.getSessionController().getSessionWrapper().beginTran saction();
try {
for (Resource resource : getResourceSet().getResources()) {
resource.unload();
}
handler.getSessionController().getSessionWrapper().commitTra nsaction();
}
catch (RuntimeException e) {
handler.getSessionController().getSessionWrapper().rollbackT ransaction();
throw e;
}
}

};
editingDomain.getCommandStack().execute(cmd);
}


(The handler is just a simple helper class to get always the one and only
SessionController)

The unload() has no more Exceptions, but the log4j-log shows:
136736 [main] DEBUG
org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
unload, has session controller, sessioncontroller is therefor responsible
for session close
136746 [main] DEBUG
org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
unload, has session controller, sessioncontroller is therefor responsible
for session close
136746 [main] DEBUG org.hibernate.transaction.JDBCTransaction - commit
136746 [main] DEBUG org.hibernate.impl.SessionImpl - automatically
flushing session
136746 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener
- flushing session
136746 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener
- processing flush-time cascades
136746 [main] DEBUG org.hibernate.engine.Cascade - processing cascade
ACTION_SAVE_UPDATE for: Prozess
136746 [main] DEBUG org.hibernate.engine.Cascade - cascade
ACTION_SAVE_UPDATE for collection: Prozess.elemente
136746 [main] DEBUG org.hibernate.engine.Cascade - done cascade
ACTION_SAVE_UPDATE for collection: Prozess.elemente
136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphans for
collection: Prozess.elemente
136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphaned
entity instance: ProzessElement
136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener -
deleting a persistent instance
136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener -
deleting [Aktivitaet#402884e9194c8ec501194c90f7fe0004]


So my only child object has been deleted!

My solution is, to do an EMF transaction without a hibernate transaction.
Then everything is ok, no more exception and no deletes.

What is wrong with the hibernate transaction?
The previous save shows a clean flush without any changes in the database.

gr. Manfred
Re: [Teneo] Unload() questions [message #616294 is a reply to message #118295] Mon, 14 April 2008 17:58 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
It seems that the unload removes the child from the parent collection. To be sure can you try/check
the following:
- is the child present in the collection before the unload?
- is the child present in the collection after the unload but before the commit?

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> my Teneo version is 0.8.0.v200804061007
>
> In the meantime I have a solution, but no understanding..;-)
>
> This is the scenario:
> Loading of a model with one root object and one child. (And another root
> object in another resource, to be honest)
> Storing the model with "save" (without any previous or later changes).
> Closing the program.
>
> When I have the original dispose() method, the unload does a .log entry:
>
> !MESSAGE Cannot modify resource set without a write transaction
> !STACK 0
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:322)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:284)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:266)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:222)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
>
> at
> org.eclipse.emf.common.notify.impl.NotificationImpl.dispatch (NotificationImpl.java:1030)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.clear(N otifyingListImpl.java:1101)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload(Re sourceImpl.java:1472)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.doUnload(StoreR esource.java:370)
>
> at
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource.d oUnload(HibernateResource.java:410)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(Reso urceImpl.java:1494)
>
> at
> de.edvchl.clic.workflow.diagram.part.WorkflowDocumentProvide r$ResourceSetInfo.dispose(WorkflowDocumentProvider.java:732)
>
>
>
> So I changed the dispose() function like this:
>
> public void dispose() {
> getResourceSet().eAdapters().remove(myResourceSetListener);
> TransactionalEditingDomain editingDomain = getEditingDomain();
> final EditingDomainHandler handler =
> EditingDomainHandler.getEditingDomainHandler();
> Command cmd = new RecordingCommand(editingDomain){
>
> @Override
> protected void doExecute() {
>
> handler.getSessionController().getSessionWrapper().beginTran saction();
> try {
> for (Resource resource :
> getResourceSet().getResources()) {
> resource.unload();
> }
>
> handler.getSessionController().getSessionWrapper().commitTra nsaction();
> }
> catch (RuntimeException e) {
>
> handler.getSessionController().getSessionWrapper().rollbackT ransaction();
> throw e;
> }
> }
>
> };
> editingDomain.getCommandStack().execute(cmd);
> }
>
>
> (The handler is just a simple helper class to get always the one and
> only SessionController)
>
> The unload() has no more Exceptions, but the log4j-log shows:
> 136736 [main] DEBUG
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
> unload, has session controller, sessioncontroller is therefor
> responsible for session close
> 136746 [main] DEBUG
> org.eclipse.emf.teneo.hibernate.resource.HibernateResource - Doing
> unload, has session controller, sessioncontroller is therefor
> responsible for session close
> 136746 [main] DEBUG org.hibernate.transaction.JDBCTransaction - commit
> 136746 [main] DEBUG org.hibernate.impl.SessionImpl - automatically
> flushing session
> 136746 [main] DEBUG
> org.hibernate.event.def.AbstractFlushingEventListener - flushing session
> 136746 [main] DEBUG
> org.hibernate.event.def.AbstractFlushingEventListener - processing
> flush-time cascades
> 136746 [main] DEBUG org.hibernate.engine.Cascade - processing cascade
> ACTION_SAVE_UPDATE for: Prozess
> 136746 [main] DEBUG org.hibernate.engine.Cascade - cascade
> ACTION_SAVE_UPDATE for collection: Prozess.elemente
> 136746 [main] DEBUG org.hibernate.engine.Cascade - done cascade
> ACTION_SAVE_UPDATE for collection: Prozess.elemente
> 136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphans for
> collection: Prozess.elemente
> 136746 [main] DEBUG org.hibernate.engine.Cascade - deleting orphaned
> entity instance: ProzessElement
> 136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener
> - deleting a persistent instance
> 136756 [main] DEBUG org.hibernate.event.def.DefaultDeleteEventListener
> - deleting [Aktivitaet#402884e9194c8ec501194c90f7fe0004]
>
>
> So my only child object has been deleted!
>
> My solution is, to do an EMF transaction without a hibernate transaction.
> Then everything is ok, no more exception and no deletes.
>
> What is wrong with the hibernate transaction?
> The previous save shows a clean flush without any changes in the database.
>
> gr. Manfred
>


--

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] Unload() questions [message #616302 is a reply to message #118333] Tue, 15 April 2008 06:54 Go to previous message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

yes, you are right! Before the unload everything is ok, but after the
unload the resource is empty (I expected this) and the model root element
has lost its child (I didn't expect this).
Is there a chain of events / event listeners that do this change during
the clearing of the resource contents list?

gr. Manfred
Re: [Teneo] Unload() questions [message #616303 is a reply to message #118368] Tue, 15 April 2008 08:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
I tested the unload and in my case the children remain in the parent (I tested using the
Library/Book/Writer example). In your case I don't know which eventlistener causes the remove of the
child. So the only option is to debug through the unload action and see what happens.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> yes, you are right! Before the unload everything is ok, but after the
> unload the resource is empty (I expected this) and the model root
> element has lost its child (I didn't expect this).
> Is there a chain of events / event listeners that do this change during
> the clearing of the resource contents list?
>
> gr. Manfred
>


--

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] Unload() questions [message #616307 is a reply to message #118377] Tue, 15 April 2008 13:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31032
Registered: July 2009
Senior Member
Martin,

I know solve folks specialize the unload behavior to decompose the
containment structure of the unloaded tree of objects. That's not the
default behavior though...


Martin Taal wrote:
> Hi Manfred,
> I tested the unload and in my case the children remain in the parent
> (I tested using the Library/Book/Writer example). In your case I don't
> know which eventlistener causes the remove of the child. So the only
> option is to debug through the unload action and see what happens.
>
> gr. Martin
>
> Manfred Hahn wrote:
>> Hi Martin,
>>
>> yes, you are right! Before the unload everything is ok, but after the
>> unload the resource is empty (I expected this) and the model root
>> element has lost its child (I didn't expect this).
>> Is there a chain of events / event listeners that do this change
>> during the clearing of the resource contents list?
>>
>> gr. Manfred
>>
>
>
Re: [Teneo] Unload() questions [message #616313 is a reply to message #118377] Tue, 15 April 2008 15:01 Go to previous message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

I've debugged the unload() and came to the following stack:
ProzessImpl.eInverseRemove(InternalEObject, int, NotificationChain) line:
245
ProzessImpl(BasicEObjectImpl).eInverseRemove(InternalEObject , int,
Class<?>, NotificationChain) line: 1421
AktivitaetImpl(ProzessElementImpl).eBasicRemoveFromContainer Feature(NotificationChain)
line: 252
AktivitaetImpl(BasicEObjectImpl).eBasicRemoveFromContainer(N otificationChain)
line: 1366
AktivitaetImpl(BasicEObjectImpl).eSetResource(Resource$Inter nal,
NotificationChain) line: 972
ResourceImpl$ContentsEList<E>.inverseRemove(E, NotificationChain) line: 386
ResourceImpl$ContentsEList<E>(NotifyingListImpl<E>).clear() line: 1092
HibernateResource(ResourceImpl).doUnload() line: 1472
HibernateResource(StoreResource).doUnload() line: 370
HibernateResource.doUnload() line: 410
HibernateResource(ResourceImpl).unload() line: 1494

This is because the resource.contents has not only the root object
(ProzessImpl) in its data list but also the child object (AktivitaetImpl).
I noticed that before but did not realize that this could be wrong. I
thought the data list would contain all objects. But it is wrong, isn't it?

I fear that the problem we discussed here

http://www.eclipse.org/newsportal/article.php?id=4805&gr oup=eclipse.technology.emft#4805

comes back in a new flavour. I did not verify this but I guess the loading
of the xml diagram resource puts the child object as another root object
into the resource. I'll debug it as soon as possible, but it could last a
few days ...

gr. Manfred
Re: [Teneo] Unload() questions [message #617771 is a reply to message #118415] Wed, 16 April 2008 07:26 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
Yes the clear and resulting remove from the container seems standard EMF and correct behavior if the
objects are in the root of the resource.
The question is how the object ended up in the root of the resource. If you debug then a good place
to put a breakpoint is in the attached* methods in the StoreResource. These are called when a new
object is added to the resource.

As a side remark.
Even if, in your case, there is an underlying solvable issue, then it is possible with a
hibernateresource to load parents and childs in the top of the resource. This can be done using
queries. In that case the same side-effect will occur. So afaics a hibernateresource should be
changed to do clear without any inverseremovals.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> I've debugged the unload() and came to the following stack:
> ProzessImpl.eInverseRemove(InternalEObject, int, NotificationChain)
> line: 245
> ProzessImpl(BasicEObjectImpl).eInverseRemove(InternalEObject , int,
> Class<?>, NotificationChain) line: 1421
> AktivitaetImpl(ProzessElementImpl).eBasicRemoveFromContainer Feature(NotificationChain)
> line: 252
> AktivitaetImpl(BasicEObjectImpl).eBasicRemoveFromContainer(N otificationChain)
> line: 1366
> AktivitaetImpl(BasicEObjectImpl).eSetResource(Resource$Inter nal,
> NotificationChain) line: 972
> ResourceImpl$ContentsEList<E>.inverseRemove(E, NotificationChain) line:
> 386
> ResourceImpl$ContentsEList<E>(NotifyingListImpl<E>).clear() line: 1092
> HibernateResource(ResourceImpl).doUnload() line: 1472
> HibernateResource(StoreResource).doUnload() line: 370
> HibernateResource.doUnload() line: 410
> HibernateResource(ResourceImpl).unload() line: 1494
>
> This is because the resource.contents has not only the root object
> (ProzessImpl) in its data list but also the child object
> (AktivitaetImpl). I noticed that before but did not realize that this
> could be wrong. I thought the data list would contain all objects. But
> it is wrong, isn't it?
>
> I fear that the problem we discussed here
>
> http://www.eclipse.org/newsportal/article.php?id=4805&gr oup=eclipse.technology.emft#4805
>
>
> comes back in a new flavour. I did not verify this but I guess the
> loading of the xml diagram resource puts the child object as another
> root object into the resource. I'll debug it as soon as possible, but it
> could last a few days ...
>
> gr. Manfred
>


--

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] Unload() questions [message #617854 is a reply to message #118658] Sat, 19 April 2008 19:28 Go to previous message
Manfred Hahn is currently offline Manfred HahnFriend
Messages: 64
Registered: July 2009
Member
Hi Martin,

I think I have found a reason for the existence of the child object in the
resource contents.

In my xml file (or BLOB) is a line like this

<element
href="hibernate://?sessionController=sessioncontroller&amp;query1=FROM
de.edvchl.clic.workflow.Prozess where bezeichnung =
'test'&amp;loadStrategy=addToContents#Aktivitaet|id=ff80 80811967bfab011967c022f10004 "/>

with the reference to my child model object.

During load of the xml source the reference is resolved and it ends up in
HibernateResouce.geEObjectByID().
The interesting thing is that the param id has the value
"Aktivitaet|id=ff8080811967bfab011967c022f10004"!
This has the effect that the object is not found with the firstCheck
though it had been loaded before and the id
"ff8080811967bfab011967c022f10004" is in the map.
Then the object is loaded from the session cache and added to the contents
as if it were a root object.

Another interesting hint:
inside addToContents there is an exception thrown somewhere in
notifications.dispatch();
this leads to a resourceSet.getEObject(proxyURI, false) in EcoreUtil line
203
I cannot see the exception in debug mode - I assume the compiler
optimized it away because it is not used.

During unload() the child object is always deleted when I do it inside of
a hibernate transaction.

Should I try to manipulate the id by overwriting
HibernateResource.getEObjectID() or is this an interesting feature for
everyone that should be done in the Teneo project?

gr. Manfred
Re: [Teneo] Unload() questions [message #617859 is a reply to message #119260] Sun, 20 April 2008 10:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Manfred,
Afaics the getObjectById should also try to find it using the real id (the part after the |). So
this is a bug (or missing feature). Can you enter a bugzilla for this?
I will solve this in the coming build (within a few days).

In addition I think that the getObjectById method should not call addToContents but the
addToContentOrAttach method. I am reworking this addToContentOrAttach method currently.

gr. Martin

Manfred Hahn wrote:
> Hi Martin,
>
> I think I have found a reason for the existence of the child object in
> the resource contents.
>
> In my xml file (or BLOB) is a line like this
>
> <element
> href="hibernate://?sessionController=sessioncontroller&amp;query1=FROM
> de.edvchl.clic.workflow.Prozess where bezeichnung =
> 'test'&amp;loadStrategy=addToContents#Aktivitaet|id=ff80 80811967bfab011967c022f10004 "/>
>
>
> with the reference to my child model object.
>
> During load of the xml source the reference is resolved and it ends up
> in HibernateResouce.geEObjectByID().
> The interesting thing is that the param id has the value
> "Aktivitaet|id=ff8080811967bfab011967c022f10004"!
> This has the effect that the object is not found with the firstCheck
> though it had been loaded before and the id
> "ff8080811967bfab011967c022f10004" is in the map. Then the object is
> loaded from the session cache and added to the contents as if it were a
> root object.
>
> Another interesting hint:
> inside addToContents there is an exception thrown somewhere in
> notifications.dispatch();
> this leads to a resourceSet.getEObject(proxyURI, false) in EcoreUtil
> line 203
> I cannot see the exception in debug mode - I assume the compiler
> optimized it away because it is not used.
>
> During unload() the child object is always deleted when I do it inside
> of a hibernate transaction.
>
> Should I try to manipulate the id by overwriting
> HibernateResource.getEObjectID() or is this an interesting feature for
> everyone that should be done in the Teneo project?
>
> gr. Manfred
>


--

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:[CDO] Client registration timeout exception
Next Topic:emfatic
Goto Forum:
  


Current Time: Sat Apr 04 16:35:52 GMT 2020

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

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

Back to the top