Java.sql.SQLException: Nom de colonne non valide, WHY?

Résolu/Fermé
mehdikwa - 26 févr. 2014 à 13:16
mehdikwa Messages postés 9 Date d'inscription mercredi 26 février 2014 Statut Membre Dernière intervention 29 mai 2014 - 3 mars 2014 à 10:29
Bonjour,

J'utilise hibernate 3 avec Spring 2.5, en essayant de lancer une requette sur une vue matérialisé je recois l'exeption ci-dessous.

Merci de m'aider.

Voici ma requette:


String sql =
"SELECT * FROM ADM_RATING.WEBCARE_TABLE WHERE CUSTOMER_ID in ("
+ "select customer_id from adm_mv.mv_customer_all "
+ "connect by prior customer_id = customer_id_high and paymntresp is null "
+ "start with customer_id = ? and paymntresp = 'X') order by CO_ID";

Collection<BscsConsumption> result =
this.jdbcTemplate.query( sql, new Object[] { new Long( coId ) }, new RowMapper()
{
public Object mapRow( ResultSet rs, int rowNum )
throws SQLException
{
return getConsumption( rs );
}
} );
return result;


Caused by: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT R.* FROM ADM_VALOTR.VIEW_RATEPLANS R WHERE CUSTOMER_ID IN (select customer_id from adm_mv.mv_customer_all connect by prior customer_id = customer_id_high and paymntresp is null start with customer_id = ? and paymntresp = 'X')]; nested exception is java.sql.SQLException: Nom de colonne non valide
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:276)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:607)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:710)
at com.orangecaraibe.vtr.dao.impl.BscsDaoImpl.getContractsOfPayer(BscsDaoImpl.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at $Proxy97.getContractsOfPayer(Unknown Source)
at com.orangecaraibe.vtr.service.impl.ManageInstalledNetworkProductConsumptionImpl.findAndGet(ManageInstalledNetworkProductConsumptionImpl.java:149)
at com.orangecaraibe.vtr.soa.provider.ManageInstalledNetworkProductConsumptionProvider.findAndGet(ManageInstalledNetworkProductConsumptionProvider.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
at com.orangecaraibe.enabler.Enabler.logMethod(Enabler.java:198)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy93.findAndGet(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
... 45 more
Caused by: java.sql.SQLException: Nom de colonne non valide
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3319)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1926)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515)
at com.orangecaraibe.vtr.dao.impl.BscsDaoImpl.getContract(BscsDaoImpl.java:498)
at com.orangecaraibe.vtr.dao.impl.BscsDaoImpl.access$200(BscsDaoImpl.java:38)
at com.orangecaraibe.vtr.dao.impl.BscsDaoImpl$9.mapRow(BscsDaoImpl.java:529)
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:653)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)

4 réponses

tarek_dotzero Messages postés 817 Date d'inscription jeudi 19 juillet 2007 Statut Membre Dernière intervention 12 avril 2022 121
27 févr. 2014 à 01:25
Bonjour,


Vérifiez votre requête, sinon mettez le schéma de la base des données (les requêtes "Create Table"). L'erreur provient de la partie jdbc alors ça ne doit pas avoir lien avec spring et hibernate, il faut descendre versle schéma de la base des données.

Bon Courage.
0