Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] org.jpox.sco.exceptions.NullsNotAllowedException on resource.save()
[Teneo] org.jpox.sco.exceptions.NullsNotAllowedException on resource.save() [message #117510] Wed, 09 April 2008 17:31 Go to next message
Eclipse UserFriend
Originally posted by: vnikolov.us.ibm.com

Hello Martin,

I've experienced a problem when trying to save a detached resource. Here
is the stack trace:

Exception in thread "main"
org.jpox.sco.exceptions.NullsNotAllowedException: Nulls are not allowed
for field writers: class = org.eclipse.example.library.impl.LibraryImpl,
field = writers
at org.jpox.sco.ArrayList.add(ArrayList.java:768)
at
org.eclipse.emf.teneo.jpox.JpoxUtil.updateListWithListElemen ts(JpoxUtil.java:155)
at
org.eclipse.emf.teneo.jpox.elist.EListWrapper.attachCopy(ELi stWrapper.java:494)
at
org.jpox.state.AttachFieldManager.storeObjectField(AttachFie ldManager.java:157)
at
org.jpox.state.StateManagerImpl.providedObjectField(StateMan agerImpl.java:2771)
at
org.eclipse.example.library.impl.LibraryImpl.jdoProvideField (LibraryImpl.java)
at
org.eclipse.example.library.impl.LibraryImpl.jdoProvideField s(LibraryImpl.java)
at
org.jpox.state.StateManagerImpl.provideFields(StateManagerIm pl.java:3115)
at
org.jpox.state.StateManagerImpl.internalAttachCopy(StateMana gerImpl.java:4389)
at org.jpox.state.StateManagerImpl.attachCopy(StateManagerImpl. java:4331)
at
org.jpox.AbstractPersistenceManager.attachCopy(AbstractPersi stenceManager.java:1431)
at
org.jpox.AbstractPersistenceManager.internalMakePersistent(A bstractPersistenceManager.java:1161)
at
org.jpox.AbstractPersistenceManager.makePersistent(AbstractP ersistenceManager.java:1277)
at
org.eclipse.emf.teneo.jpox.resource.JPOXResource.saveResourc e(JPOXResource.java:381)
at
org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:348)
at package1.MainClass.main(MainClass.java:111)



While detached - when I add an element to the end of an EList and then
call resource.save() - it works fine. If I try to add an element in the
middle of an EList and call resource.save() - the exception above is
thrown. What I have observed is when attachedList.add(newpos, obj) fails
the INDEX column in the respective table in the DB gets inconsistent.
Do you have any ideas? Is there something I'm missing?


I have prepared a small testcase which I'm going to send it to you via mail.

I'm using Teneo v0.8.0.

Thank you,
Vladimir
Re: [Teneo] org.jpox.sco.exceptions.NullsNotAllowedException on resource.save() [message #117635 is a reply to message #117510] Thu, 10 April 2008 08:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Vladimir,
Thanks for the testcase it helped to find the bug. I solved the bug and will commit it to cvs shortly.

FYI the following occured:
The new object was added to the list at a specific position, at resource.save the detached list is
matched with the current list in the db and the list in the db is updated. The update action first
adds the new writer to the list (at the end) and then moves it to the correct location. The move
operation first did a remove and then an add (with index). This remove resulted in a remove of the
writer of the db, eventhough it was present in the list in another location.
This resulted in the new writer not being persisted (or actually it was persisted but removed
immediately), no exception was thrown so the old writer was moved to index 1. When reading the list
in the next run this resulted in a null entry in the list at position 0.

I changed the update logic to not do remove.

Note the above situation probably only occurs in case of detached objects.

gr. Martin

Vladimir Nikolov wrote:
> Hello Martin,
>
> I've experienced a problem when trying to save a detached resource. Here
> is the stack trace:
>
> Exception in thread "main"
> org.jpox.sco.exceptions.NullsNotAllowedException: Nulls are not allowed
> for field writers: class = org.eclipse.example.library.impl.LibraryImpl,
> field = writers
> at org.jpox.sco.ArrayList.add(ArrayList.java:768)
> at
> org.eclipse.emf.teneo.jpox.JpoxUtil.updateListWithListElemen ts(JpoxUtil.java:155)
>
> at
> org.eclipse.emf.teneo.jpox.elist.EListWrapper.attachCopy(ELi stWrapper.java:494)
>
> at
> org.jpox.state.AttachFieldManager.storeObjectField(AttachFie ldManager.java:157)
>
> at
> org.jpox.state.StateManagerImpl.providedObjectField(StateMan agerImpl.java:2771)
>
> at
> org.eclipse.example.library.impl.LibraryImpl.jdoProvideField (LibraryImpl.java)
>
> at
> org.eclipse.example.library.impl.LibraryImpl.jdoProvideField s(LibraryImpl.java)
>
> at
> org.jpox.state.StateManagerImpl.provideFields(StateManagerIm pl.java:3115)
> at
> org.jpox.state.StateManagerImpl.internalAttachCopy(StateMana gerImpl.java:4389)
>
> at
> org.jpox.state.StateManagerImpl.attachCopy(StateManagerImpl. java:4331)
> at
> org.jpox.AbstractPersistenceManager.attachCopy(AbstractPersi stenceManager.java:1431)
>
> at
> org.jpox.AbstractPersistenceManager.internalMakePersistent(A bstractPersistenceManager.java:1161)
>
> at
> org.jpox.AbstractPersistenceManager.makePersistent(AbstractP ersistenceManager.java:1277)
>
> at
> org.eclipse.emf.teneo.jpox.resource.JPOXResource.saveResourc e(JPOXResource.java:381)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:348)
> at package1.MainClass.main(MainClass.java:111)
>
>
>
> While detached - when I add an element to the end of an EList and then
> call resource.save() - it works fine. If I try to add an element in the
> middle of an EList and call resource.save() - the exception above is
> thrown. What I have observed is when attachedList.add(newpos, obj) fails
> the INDEX column in the respective table in the DB gets inconsistent.
> Do you have any ideas? Is there something I'm missing?
>
>
> I have prepared a small testcase which I'm going to send it to you via
> mail.
>
> I'm using Teneo v0.8.0.
>
> Thank you,
> Vladimir


--

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] org.jpox.sco.exceptions.NullsNotAllowedException on resource.save() [message #616179 is a reply to message #117510] Thu, 10 April 2008 08:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Vladimir,
Thanks for the testcase it helped to find the bug. I solved the bug and will commit it to cvs shortly.

FYI the following occured:
The new object was added to the list at a specific position, at resource.save the detached list is
matched with the current list in the db and the list in the db is updated. The update action first
adds the new writer to the list (at the end) and then moves it to the correct location. The move
operation first did a remove and then an add (with index). This remove resulted in a remove of the
writer of the db, eventhough it was present in the list in another location.
This resulted in the new writer not being persisted (or actually it was persisted but removed
immediately), no exception was thrown so the old writer was moved to index 1. When reading the list
in the next run this resulted in a null entry in the list at position 0.

I changed the update logic to not do remove.

Note the above situation probably only occurs in case of detached objects.

gr. Martin

Vladimir Nikolov wrote:
> Hello Martin,
>
> I've experienced a problem when trying to save a detached resource. Here
> is the stack trace:
>
> Exception in thread "main"
> org.jpox.sco.exceptions.NullsNotAllowedException: Nulls are not allowed
> for field writers: class = org.eclipse.example.library.impl.LibraryImpl,
> field = writers
> at org.jpox.sco.ArrayList.add(ArrayList.java:768)
> at
> org.eclipse.emf.teneo.jpox.JpoxUtil.updateListWithListElemen ts(JpoxUtil.java:155)
>
> at
> org.eclipse.emf.teneo.jpox.elist.EListWrapper.attachCopy(ELi stWrapper.java:494)
>
> at
> org.jpox.state.AttachFieldManager.storeObjectField(AttachFie ldManager.java:157)
>
> at
> org.jpox.state.StateManagerImpl.providedObjectField(StateMan agerImpl.java:2771)
>
> at
> org.eclipse.example.library.impl.LibraryImpl.jdoProvideField (LibraryImpl.java)
>
> at
> org.eclipse.example.library.impl.LibraryImpl.jdoProvideField s(LibraryImpl.java)
>
> at
> org.jpox.state.StateManagerImpl.provideFields(StateManagerIm pl.java:3115)
> at
> org.jpox.state.StateManagerImpl.internalAttachCopy(StateMana gerImpl.java:4389)
>
> at
> org.jpox.state.StateManagerImpl.attachCopy(StateManagerImpl. java:4331)
> at
> org.jpox.AbstractPersistenceManager.attachCopy(AbstractPersi stenceManager.java:1431)
>
> at
> org.jpox.AbstractPersistenceManager.internalMakePersistent(A bstractPersistenceManager.java:1161)
>
> at
> org.jpox.AbstractPersistenceManager.makePersistent(AbstractP ersistenceManager.java:1277)
>
> at
> org.eclipse.emf.teneo.jpox.resource.JPOXResource.saveResourc e(JPOXResource.java:381)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.save(StoreResou rce.java:348)
> at package1.MainClass.main(MainClass.java:111)
>
>
>
> While detached - when I add an element to the end of an EList and then
> call resource.save() - it works fine. If I try to add an element in the
> middle of an EList and call resource.save() - the exception above is
> thrown. What I have observed is when attachedList.add(newpos, obj) fails
> the INDEX column in the respective table in the DB gets inconsistent.
> Do you have any ideas? Is there something I'm missing?
>
>
> I have prepared a small testcase which I'm going to send it to you via
> mail.
>
> I'm using Teneo v0.8.0.
>
> Thank you,
> Vladimir


--

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] Release 1 date?
Next Topic:[EMF Compare] Release 1 date?
Goto Forum:
  


Current Time: Fri Apr 19 05:40:34 GMT 2024

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

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

Back to the top