metteo / javageomodel

Automatically exported from code.google.com/p/javageomodel
0 stars 0 forks source link

proximitySearch: NPE at com.beoui.geocell.JPAGeocellQueryEngine.query(JPAGeocellQueryEngine.java:32) (version 0.0.7) #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create code as in the example for JPA. Of course with a working EntityManager
2. Execute code

What is the expected output? What do you see instead?
Expected: List of entities that match the query.
Result: NullPointerException

What version of the product are you using? On what operating system?
0.0.7 GAE/J JPA

Please provide any additional information below.
When doing a proximity search, I get the following error. 
A BB-search with a query like "Query q = em.createQuery("select p from " + 
MyPoint.class.getName() + " p where p.geoCells.contains(:searchCells)");" works 
fine. I hope somebody can give me some insight in case it is my fault, or 
otherwise, track the issue down and fix it in the javageomodel-project.

Caused by: java.lang.NullPointerException
    at com.beoui.geocell.JPAGeocellQueryEngine.query(JPAGeocellQueryEngine.java:32)
    at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:381)
    at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:336)
    at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:330)
    at myproject.dao.Dao.getPointsInArea(Dao.java:125)

The code:
public List<MyPoint> getPointsInArea(float lat, float lon, int radius) {
        EntityManager em = EMF.getInstance().createEntityManager();
        Point center = new Point(lat, lon);
        GeocellQuery baseQuery = new GeocellQuery();
        List<MyPoint> points = GeocellManager.proximitySearch(center, 900, radius, MyPoint.class, baseQuery, em);
        return points;
    }

Original issue reported on code.google.com by hellekalek on 17 Jun 2011 at 9:19

GoogleCodeExporter commented 9 years ago
It's because you've an empty baseQuery.
it's fixed in the 0.0.8 version, you can try it again now.

Original comment by alexandr...@gmail.com on 15 Jul 2011 at 3:14

GoogleCodeExporter commented 9 years ago

Original comment by alexandr...@gmail.com on 15 Jul 2011 at 3:14