Bonjour j'ai besoin de faire un select dans un from.

J'ai utiliser le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
    @NamedQuery(name = "SessionPersonne.findAllPremiereVisiteByPays",query = "SELECT t1.cDate , t1.idT1 FROM ( SELECT cast( p.momentDePassage as date)  as cDate , COUNT(p)as countById ,p.sessionPersonne.keySessionPersonne as idT1 FROM Passage p GROUP BY cDate,idT1  ) AS t1  "),
et j'ai le message d'erreur suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
ejb: 2016-03-15 14:39:00.472--ServerSession(1092521071)--Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [SELECT t1.cDate , t1.idT1 FROM ( SELECT cast( p.momentDePassage as date)  as cDate , COUNT(p)as countById ,p.sessionPersonne.keySessionPersonne as idT1 FROM Passage p GROUP BY cDate,idT1  ) AS t1  ]. 
[30, 190] '(SELECT cast(p.momentDePassage as date) as cDate, COUNT(p) as countById, p.sessionPersonne.keySessionPersonne as idT1 FROM Passage p GROUP BY cDate, idT1) AS t1' cannot be the first declaration of the FROM clause.
ServletContextListener destroyed
15-Mar-2016 14:39:00.472 SEVERE [http-nio-8084-exec-220] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
15-Mar-2016 14:39:00.480 SEVERE [http-nio-8084-exec-220] org.apache.catalina.core.StandardContext.startInternal Erreur de démarrage du contexte [/Client] suite aux erreurs précédentes
15-Mar-2016 14:39:00.484 WARNING [http-nio-8084-exec-220] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [Client] registered the JDBC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
15-Mar-2016 14:39:00.485 SEVERE [http-nio-8084-exec-220] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [Client] created a ThreadLocal with key of type [com.microsoft.sqlserver.jdbc.ActivityCorrelator$1] (value [com.microsoft.sqlserver.jdbc.ActivityCorrelator$1@6bc3645b]) and a value of type [com.microsoft.sqlserver.jdbc.ActivityId] (value [4aae6d29-6c81-4d16-a84c-02bff9e498e5-2]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
15-Mar-2016 14:39:00.486 INFO [http-nio-8084-exec-220] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor
Pouvez vous m'aidez ?

Merci d'avance.