DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Christian Ernst
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store MongoDB

java.lang.NullPointerException in makePersistent when persisting array field

Created: 10/May/11 02:43 PM   Updated: 14/Jun/11 12:24 PM   Resolved: 10/May/11 03:39 PM
Component/s: None
Affects Version/s: 3.0.0.m4
Fix Version/s: 3.0.0.m5

File Attachments: 1. Zip Archive (16 kB)

Datastore: Other

 Description  « Hide
It seems that on a certain model with an array attribute a NullPointerException is thrown on makePersistent
Exception in thread "main" java.lang.NullPointerException
at org.datanucleus.state.AbstractStateManager.providedObjectField(
at model.B.jdoProvideField(
at model.B.jdoProvideFields(
at org.datanucleus.state.AbstractStateManager.provideFields(
at org.datanucleus.state.AbstractStateManager.providedObjectField(
at model.A.jdoProvideField(
at model.A.jdoProvideFields(
at org.datanucleus.state.AbstractStateManager.provideFields(
at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(
at org.datanucleus.state.JDOStateManagerImpl.makePersistent(
at org.datanucleus.ObjectManagerImpl.persistObjectInternal(
at org.datanucleus.ObjectManagerImpl.persistObject(
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(
at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(
at test.Test.main(
public class A {
private List<B> list = new ArrayList<B>();
public List<B> getList() {return list;}
public void setList(List<B> list) {this.list = list;}
public void add(B aB){list.add(aB);}

public class B {
private C[] array = new C[] {};
public C[] getArray() {return array;}
public void setArray(C[] array) {this.array = array;}

public class C {
  <package name="model">
   <class name="A">
            <field name="list" embedded="true">
         <collection element-type="B"/>
        <class name="B">
<field name="array" embedded="false">
        <array element-type="C"/>
    <class name="C"/>
PersistenceManager pm = pmf.getPersistenceManager();
Transaction txn = pm.currentTransaction();
A p = new A();
B p1 = new B();

Christian Ernst made changes - 10/May/11 02:44 PM
Field Original Value New Value
Attachment [ 11442 ]
Christian Ernst added a comment - 10/May/11 02:57 PM
seems to have something todo with the embedded flag

Andy Jefferson added a comment - 10/May/11 03:39 PM
Copy-paste error

Andy Jefferson made changes - 10/May/11 03:39 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.0.m5 [ 11246 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 17/May/11 09:52 AM
Summary java.lang.NullPointerException in makePersistent java.lang.NullPointerException in makePersistent when persisting array field
Andy Jefferson made changes - 14/Jun/11 12:24 PM
Status Resolved [ 5 ] Closed [ 6 ]