Hibernate Max value for each group -


i new hibernate. mapping between table , class given this.

<?xml version='1.0' encoding='utf-8'?>   <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en"   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping>     <class name="com.pathfinder.beans.location" table="vehicle_locations">         <id name="rowid" column="position_id">             <generator class="native"></generator>         </id>         <property name="vehicleid" column="vehicle_id"></property>         <property name="latitude" column="latitude"></property>         <property name="longitude" column="longitude"></property>         <property name="time" column="time"></property>         <property name="createdtime" column="createdtime"></property>     </class> </hibernate-mapping>  

now need latitude, longitude, time each vehicleid latest createdtime. sql query, can

select a.vehicle_id, a.latitude, a.longitude, a.time vehicle_locations left join  vehicle_locations b on a.vehicle_id = b.vehicle_id , a.createdtime < b.createdtime b.position_id null; 

but when try same join in hql, gives error

java.lang.illegalstateexception: dot node no left-hand-side!

how can expected results using hibernate?

you can try below hql

select a.vehicle_id, a.latitude, a.longitude, a.time  vehicle_locations left join vehicle_locations b a.vehicle_id = b.vehicle_id , a.createdtime < b.createdtime b.position_id null; 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -