Issue #316: [ObjectDB 2.2.5_02] Unexpected exception (Error 990) com.objectdb.o.InternalException: java.lang.NullPointerException: null

Type: Bug ReoprtVersion: 1.4.0Priority: NormalStatus: FixedReplies: 2
#1

reporting issue as requested 

[ObjectDB 2.2.5_02] Unexpected exception (Error 990)
  Generated by Java HotSpot(TM) Client VM 1.6.0_17 (on Windows XP 5.1).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: java.lang.NullPointerException: null
java.lang.NullPointerException
at com.objectdb.jpa.type.IdentifiableTypeImpl.initAttributes(IdentifiableTypeImpl.java:110)
at com.objectdb.jpa.MetamodelImpl.obtainType(MetamodelImpl.java:290)
at com.objectdb.jpa.MetamodelImpl.obtainType(MetamodelImpl.java:264)
at com.objectdb.jpa.MetamodelImpl.entity(MetamodelImpl.java:167)
at com.objectdb.jpa.criteria.AbstractQueryImpl.from(AbstractQueryImpl.java:158)
at com.coastlinemap.jpa.entity.ChartJPAController.findChartEntities(ChartJPAController.java:124)
at com.coastlinemap.jpa.entity.ChartJPAController.findChartEntities(ChartJPAController.java:113)

my code (generated by netbeans) for findEntities() is as follows:

public List<Chart> findChartEntities() {
        return findChartEntities(true, -1, -1);
    }

 

    public List<Chart> findChartEntities(int maxResults, int firstResult) {
        return findChartEntities(false, maxResults, firstResult);
    }
    private List<Chart> findChartEntities(boolean all, int maxResults, int firstResult) {
        EntityManager em = getEntityManager();
        try {
            CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
            cq.select(cq.from(Chart.class));
            Query q = em.createQuery(cq);
            if (!all) {
                q.setMaxResults(maxResults);
                q.setFirstResult(firstResult);
            }
            return q.getResultList();
        } finally {
            em.close();
        }
    }

 

 

Also, the entity class

@Entity
@Access(AccessType.PROPERTY)
public class Chart implements Serializable {

    private TimePeriod id;
    private List<Point> points;

    public Chart() {
        this.points = new ArrayList<Point>();
        this.reverseOrder = Boolean.TRUE;
    }

    @EmbeddedId
    public TimePeriod getId() {
        return id;
    }

    public void setId(TimePeriod id) {
        this.id = id;
    }

    @OneToMany(cascade=javax.persistence.CascadeType.ALL,fetch=javax.persistence.FetchType.EAGER)
    public List<Point> getPoints() {
        return points;
    }

    public void setPoints(List<Point> points) {
        this.points = points;
    }

}

 

And its embedded primary key

@Embeddable
@Access(AccessType.PROPERTY)
public class TimePeriod implements Serializable

{
    private long beginTime;
    private long endTime;
    private String periodType;

   public long getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(long beginTime) {
        this.beginTime = beginTime;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public String getPeriodType() {
        return periodType;
    }

    public void setPeriodType(String periodType) {
        this.periodType = periodType;
    }


}

 

#2

Thank you for your report.

Build 2.2.5_09 should fix this NullPointerException.

ObjectDB Support
#3

Thank you for a quick turnaround.

I can confirm it fixed using Build 2.2.5_10

Reply