-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Jpql - order by sum ???
PostPosted: Mon Aug 30, 2010 12:38 pm 
Newbie

Joined: Mon Aug 30, 2010 12:34 pm
Posts: 4
MYSQL
JAVA EE 6
JPA 2

Hallo,
ich möchte aus einer DB "Video-Objekte" absteigend
- danach wie oft bzw. wie gut sie gevotet(RATING) worden sind - holen.


VideoRatingEntity
@ManyToOne()
@JoinColumn(name = "VIDEO_ID")
videoEntity

ID | VIDEO_ID| USER_ID| RATING
--------------------------------


Video Entity
@OneToMany
videoRatingEntities

ID | ... | ... |
-------------


Mein Ansatz:
"SELECT v, sum(vrr) "
+ " FROM VideoEntity AS v"
+ " JOIN v.videoRatingEntities AS vr"
+ " JOIN vr.rating AS vrr"
+ " GROUP BY v"
+ " ORDER BY sum(vrr) DESC";


EXCEPTION:
SCHWERWIEGEND: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT v, sum(vrr) FROM VideoEntity AS v JOIN v.videoRatingEntities AS vr JOIN vr.rating AS vrr GROUP BY v ORDER BY sum(vrr) DESC].
Internal Exception: org.eclipse.persistence.internal.libraries.antlr.runtime.EarlyExitException


Hoffe jemand kann weiterhelfen.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.