How I can use ABS function in Hibernate queries?
I try use this function as shown below, but NullPointerException is occuried
Code:
String query = "from Area l where ((l.minX >= :minX) and (l.maxX <= :maxX) and (l.minY >= :minY) and (l.maxY <= :maxY)) or (not ((l.maxX < :minX) or (l.minX > :maxX) or (l.maxY < :minY) or (l.minY > :maxY))) and (:pixelWidth * abs(l.maxX - l.minX) / :parentWidth >= :limitWidth) and (:pixelHeight * abs(l.maxY - l.minY) / :parentHeight >= :limitHeight)";
Parameters:
Code:
queryObject.setBigDecimal("minX", minXBD);
queryObject.setBigDecimal("minY", minYBD);
queryObject.setBigDecimal("maxX", maxXBD);
queryObject.setBigDecimal("maxY", maxYBD);
queryObject.setBigDecimal("parentHeight", latLongHeight);
queryObject.setBigDecimal("parentWidth", latLongWidth);
queryObject.setInteger("pixelHeight", height);
queryObject.setInteger("pixelWidth", width);
queryObject.setInteger("limitHeight", LIMIT_HEIGHT);
queryObject.setInteger("limitWidth", LIMIT_WIDTH);
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html