257 words

Issue #238 - NullpointerException when execute a commit

BugVersion: Priority: HighStatus: FixedReplies: 1
#1
2014-11-28 08:18

Hello,

following exception occurs when using objectdb:


com.objectdb.o.UserException: Failed to commit transaction: Unexpected internal exception
at com.objectdb.o.MSG.d(MSG.java:75)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:304)
....
Caused by: com.objectdb.o.InternalException: Unexpected internal exception
at com.objectdb.o.JPE.h(JPE.java:168)
at com.objectdb.o.ERR.f(ERR.java:66)
at com.objectdb.o.IVP.l(IVP.java:148)
at com.objectdb.o.IVP.k(IVP.java:130)
at com.objectdb.o.ISP.size(ISP.java:163)
at com.objectdb.o.CLT.visitRefs(CLT.java:156)
at com.objectdb.o.TVS.j(TVS.java:169)
at com.objectdb.o.TVS.cascade(TVS.java:156)
at com.objectdb.o.STA.Q(STA.java:476)
at com.objectdb.o.STM.E(STM.java:407)
at com.objectdb.o.OBM.bO(OBM.java:910)
at com.objectdb.jdo.PMImpl.bO(PMImpl.java:2267)
at com.objectdb.o.OBM.bN(OBM.java:826)
at com.objectdb.o.OBM.bL(OBM.java:740)
at com.objectdb.jpa.EMImpl.commit(EMImpl.java:299)
... 45 more
Caused by: java.lang.NullPointerException
at com.objectdb.o.ISP.size(ISP.java:164)
at com.objectdb.o.CLT.visitRefs(CLT.java:156)
at com.objectdb.o.TVS.j(TVS.java:169)
at com.objectdb.o.TVS.cascade(TVS.java:156)
at com.objectdb.o.STA.Q(STA.java:476)
at com.objectdb.o.STM.E(STM.java:407)
at com.objectdb.o.OBM.bO(OBM.java:910)
at com.objectdb.jdo.PMImpl.bO(PMImpl.java:2267)
at com.objectdb.o.OBM.bN(OBM.java:826)
at com.objectdb.o.OBM.bM(OBM.java:776)
at com.objectdb.o.QRR.f(QRR.java:139)
at com.objectdb.o.QRR.a(QRR.java:618)
at com.objectdb.o.InvMemberQuery.e(InvMemberQuery.java:139)
at com.objectdb.o.UMR.v(UMR.java:508)
at com.objectdb.o.ENT.loadInverse(ENT.java:1472)
at com.objectdb.o.IVP.l(IVP.java:142)
... 57 more

 

Have you an idea what is the cause of this problem?

Following is the example code.

Thanks

 

entity classes:

public class PatternData extends FormalismData {

    ...  
}

public class FormalismData {

    ...

    private Set<ContractData> usedAsAssumptions;

    public Set<ContractData> getUsedAsAssumptions() {
        if (usedAsAssumptions == null) {
            usedAsAssumptions = new HashSet<ContractData>();
        }
        return usedAsAssumptions;
    }

    public void setUsedAsAssumptions(Set<ContractData> usedAsAssumptions) {
        this.usedAsAssumptions = usedAsAssumptions;
    }

    private Set<ContractData> usedAsCommitments;

    public Set<ContractData> getUsedAsCommitments() {
        if (usedAsCommitments == null) {
            usedAsCommitments = new HashSet<ContractData>();
        }
        return usedAsCommitments;
    }

    public void setUsedAsCommitments(Set<ContractData> usedAsCommitments) {
        this.usedAsCommitments = usedAsCommitments;
    }
  
}


public class ContractData {

    ...

    private List<FormalismData> assumptions = new ArrayList<FormalismData>();

    public List<FormalismData> getAssumptions() {
        return assumptions;
    }

    public void setAssumptions(List<FormalismData> assumptions) {
        this.assumptions = assumptions;
    }

    private FormalismData commitment;

    public FormalismData getCommitment() {
        return commitment;
    }

    public void setCommitment(FormalismData commitment) {
        this.commitment = commitment;
    }
}


orm.xml:

<entity class="test.PatternData">
  <attributes>
...
  </attributes>
</entity>
<entity class="test.ContractData">
  <attributes>
   <many-to-one name="commitment" target-entity="test.FormalismData">
    <cascade>
     <cascade-all />
    </cascade>
   </many-to-one>
   <many-to-many name="assumptions" target-entity="test.FormalismData">
    <cascade>
     <cascade-all />
    </cascade>
   </many-to-many>
  </attributes>
</entity>
<entity class="test.FormalismData">
  <attributes>
   <one-to-many name="usedAsCommitments" mapped-by="commitment" target-entity="test.ContractData">
    <cascade>
     <cascade-all />
    </cascade>
   </one-to-many>
   <many-to-many name="usedAsAssumptions" target-entity="test.ContractData" mapped-by="assumptions">
    <cascade>
     <cascade-all />
    </cascade>
   </many-to-many>
  </attributes>
</entity>

 

code:

...

PatternData pattern = new PatternData();
entitymanager.persist(pattern);
transation.commit(); // success

...

transation.begin();
ContractData contract = new ContractData();
entitymanager.persist(contract);
contract.setCommitment(pattern);
transation.commit(); // cause the NullpointerException

 

 

btc_es
btc_es's picture
Joined on 2014-10-20
User Post #1
#2
2014-12-01 09:40

Thank you for your report.

Please try build 2.5.7_07 that should fix this issue.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,093

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel