590 words

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

BugVersion: 1.04Priority: NormalStatus: FixedReplies: 2
#1
2011-06-01 17:24

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;
    }
 
 
}

 

longpat
longpat's picture
Joined on 2011-05-30
User Post #4
#2
2011-06-02 00:23

Thank you for your report.

Build 2.2.5_09 should fix this NullPointerException.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #319
#3
2011-06-02 15:09

Thank you for a quick turnaround.

I can confirm it fixed using Build 2.2.5_10

longpat
longpat's picture
Joined on 2011-05-30
User Post #5

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