Using list length property in HQL results in unresolved compilation error
The following code results in an unresolved compilation error:
// Environment entity Song { likedby <> List<Like> } entity Like { song -> Song (inverse=Song.likedby) } // Usage for(s : Song order by s.likedby.length desc) { // code here }
Result:
Cannot invoke compareTo(int) on the primitive type int
Generated code:
return o2.setupForPropertyEvents(hibSession, out).getLikedby().size().compareTo(o1.setupForPropertyEvents(hibSession, out).getLikedby().size());And since o2.setupForPropertyEvents(hibSession, out).getLikedby().size() is a primitive int, this does not compile.
Submitted by Ot ten Thije on 25 March 2010 at 15:28
Log in to post comments