724 words

Problem with byte arrays in JDO - internal exception

2017-09-12 01:38

This code generates an internal exception:

package spiffy.test;
import java.util.List;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Query;
import spiffy.test.model.Example;
* @author steve
public class ObjectdbTest {
     * @param args the command line arguments
    public static void main(String[] args) {
        PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory("test.odb");
        PersistenceManager pm = pmf.getPersistenceManager();
        // Clear out existing objects
        Query query = pm.newQuery(Example.class);
        Example example1 = new Example();
        example1.setData(new byte[1]);
        example1.getData()[0] = 123;
        Example example2 = new Example();
        example2.setData(new byte[2]);
        example2.getData()[0] = 12;
        query = pm.newQuery(Example.class, "name == :name");
        List<Example> dataList = (List<Example>) query.execute("name1");
        for (Example data : dataList) {
package spiffy.test.model;
* @author steve
public class Example {
    private long id;
    private String name;
    private byte[] data;
     * @return the id
    public long getId() {
        return id;
     * @param id the id to set
    public void setId(long id) {
        this.id = id;
     * @return the name
    public String getName() {
        return name;
     * @param name the name to set
    public void setName(String name) {
        this.name = name;
     * @return the data
    public byte[] getData() {
        return data;
     * @param data the data to set
    public void setData(byte[] data) {
        this.data = data;
<?xml version="1.0"?>
<jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
        http://xmlns.jcp.org/xml/ns/jdo/jdo_2_0.xsd" version="2.0">
    <package name="spiffy.test.model">
        <class name="Example">
            <field name="id" primary-key="true"/>
            <field name="name" persistence-modifier="persistent"/>
            <field name="data" persistence-modifier="persistent"/>
Exception in thread "main" [ObjectDB 2.7.1_01] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) 64-Bit Server VM 1.8.0_131 (on Linux 4.10.0-33-generic).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: null
at com.objectdb.o.InternalException.f(InternalException.java:236)
at com.objectdb.o.STA.K(STA.java:348)
at com.objectdb.o.ENT.F(ENT.java:546)
at com.objectdb.o.LDR.M(LDR.java:855)
at com.objectdb.o.LDR.L(LDR.java:834)
at com.objectdb.o.LDR.Vz(LDR.java:1061)
at com.objectdb.o.RTT.G(RTT.java:267)
at com.objectdb.o.RTT.F(RTT.java:249)
at com.objectdb.o.RST.C(RST.java:180)
at com.objectdb.o.RTT.l(RTT.java:134)
at com.objectdb.o.RST.l(RST.java:24)
at com.objectdb.o.TSK.i(TSK.java:145)
at com.objectdb.o.TSK.f(TSK.java:95)
at com.objectdb.o.MST.a1(MST.java:609)
at com.objectdb.o.MST.U7(MST.java:565)
at com.objectdb.o.WRA.U7(WRA.java:279)
at com.objectdb.o.LDR.G(LDR.java:583)
at com.objectdb.o.LDR.F(LDR.java:473)
at com.objectdb.o.OBC.U2(OBC.java:1102)
at com.objectdb.o.QRR.f(QRR.java:222)
at com.objectdb.jdo.JdoQuery.execute0(JdoQuery.java:844)
at com.objectdb.jdo.JdoQuery.execute(JdoQuery.java:761)
at spiffy.test.ObjectdbTest.main(ObjectdbTest.java:42)
sjzlondon's picture
Joined on 2013-04-21
User Post #38
2017-09-12 15:36

There was a bug in handling JDO delete queries. Please try build 2.7.1_07.

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

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.
Maximum file size: 32 MB