-->
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: Invalid column name: clazz_0_
PostPosted: Thu Aug 04, 2005 11:21 am 
Beginner
Beginner

Joined: Wed Mar 03, 2004 9:44 am
Posts: 23
Location: Brasil
Please, I have a basic class and a a subclass, see below my mapping:

<class name="br.com.valoriza.siteassetline.indicadores.Indicador" dynamic-update="false" dynamic-insert="false">

<id name="id" type="int" column="IdIndicador">
<generator class="native"/>
</id>
<property name="idGrupo" type="int" column="idGrupo"/>
<property name="nome" type="java.lang.String" column="Indicador"/>

<joined-subclass name="br.com.valoriza.siteassetline.relatorios.IndicadorRepGuide">
<key column="IdIndicador" />
<property name="formato" type="java.lang.String" column="Formato"/>
</joined-subclass>

</class>

Now, my Indicador subclass:

public class IndicadorRepGuide extends Indicador {
private String formato;

public String getFormato() {
return formato;
}

public void setFormato(String formato) {
this.formato = formato;
}

}

And finally my query:

<sql-query name="IndicadoresRaioX_SQL">
<return alias="indicadores" class="br.com.valoriza.siteassetline.indicadores.Indicador">
<return-property name="id" column="IdIndicador"/>
<return-property name="idGrupo" column="idGrupo"/>
<return-property name="nome" column="Indicador"/>
</return>
SELECT RMI.IdIndicador, RMI.IdGrupo, IDC.Nome_P + (CASE IDC.Consolidado WHEN 1 THEN '-CS' ELSE '' END)
AS Indicador FROM RaioX_Mercado_Indicadores AS RMI
INNER JOIN W_Indic_Definicao_Consulta AS IDC ON IDC.IdIndicador = RMI.IdIndicador
INNER JOIN W_Indic_Grupo_Consulta AS IGC ON IGC.IdGrupo = RMI.IdGrupo
ORDER BY IGC.Ordem, IDC.Ordem
</sql-query>

If I comment the mapping of the joined-subclass "br.com.valoriza.siteassetline.relatorios.IndicadorRepGuide", the "IndicadoresRaioX_SQL" query works fine... If I uncomment this, with the same query "IndicadoresRaioX_SQL", I get the exception:

org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: could not execute query; bad SQL grammar [SELECT RMI.IdIndicador, RMI.IdGrupo, IDC.Nome_P + (CASE IDC.Consolidado WHEN 1 THEN '-CS' ELSE '' END) AS Indicador FROM RaioX_Mercado_Indicadores AS RMI
INNER JOIN W_Indic_Definicao_Consulta AS IDC ON IDC.IdIndicador = RMI.IdIndicador
INNER JOIN W_Indic_Grupo_Consulta AS IGC ON IGC.IdGrupo = RMI.IdGrupo
ORDER BY IGC.Ordem, IDC.Ordem]; nested exception is java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Invalid column name: clazz_0_
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Invalid column name: clazz_0_
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getColumnOrdinal(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getInt(Unknown Source)
at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:236)
at org.hibernate.type.IntegerType.get(IntegerType.java:26)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:94)
at org.hibernate.loader.Loader.getInstanceClass(Loader.java:1035)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:924)
at org.hibernate.loader.Loader.getRow(Loader.java:855)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:305)
at org.hibernate.loader.Loader.doQuery(Loader.java:412)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:112)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1414)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:153)
at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:815)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:806)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:798)
at br.com.valoriza.siteassetline.indicadores.ServicoIndicadores.getIndicadoresRaioX(ServicoIndicadores.java:46)
at br.com.valoriza.siteassetline.indicadores.JavaScriptIndicadoresRaioX.getCodigo(JavaScriptIndicadoresRaioX.java:33)
at br.com.valoriza.jsp.mvc.visao.TagJavaScript.doStartTag(TagJavaScript.java:46)
at org.apache.jsp.jsp.indicadores.raiox_jsp._jspx_meth_mvc_javascript_1(raiox_jsp.java:690)
at org.apache.jsp.jsp.indicadores.raiox_jsp._jspService(raiox_jsp.java:325)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at br.com.valoriza.jsp.mvc.controle.ServletControleMVC.encaminha(ServletControleMVC.java:51)
at br.com.valoriza.jsp.mvc.controle.ServletControle.doGet(ServletControle.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at br.com.valoriza.jsp.mvc.controle.ServletControleLink.encaminha(ServletControleLink.java:66)
at br.com.valoriza.jsp.mvc.controle.ServletControle.doGet(ServletControle.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

Anybody can help me?

[]s

Ary Junior


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.