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.  [ 3 posts ] 
Author Message
 Post subject: Help - SQL-Query
PostPosted: Thu Mar 23, 2006 6:28 pm 
Regular
Regular

Joined: Wed Feb 22, 2006 11:28 am
Posts: 65
Location: Santiago, Chile
Hello EveryBody:

I use Microsoft SQL Server, and when i am developing our enterprise application with hibernate, I found one problem when i get SQL native query:

This is my Query:
[code]<sql-query name="mySqlQuery">
<return alias="orden" class="net.excelsys.stockMarket.order.solicitud.vo.ORWEBVO" >
<return-property name="rutCliente" column="RUT_CLI"/>
<return-property name="id" column="SECUENCIA"/>
</return>
SELECT
so.sol_rut_cliente AS RUT_CLI,
so.sol_sec as SECUENCIA
FROM SOLICITUD so, ORDEN ord
WHERE so.sol_sec = ord.sol_sec and
(ord.ord_sec = :idOrden ) AND (ord.ord_estado <> 'AN')
</sql-query>[/code]


But, that throws one exception :
[Microsoft][SQLServer 2000 Driver for JDBC]Invalid column name: IN_RUTEO

The hibernate mapping file of the object ORWEBVO is:

[code]<hibernate-mapping>
<class name="net.excelsys.stockMarket.order.solicitud.vo.ORWEBVO" table="TBORWEB">
<id name="id" column="SECUENCIA">
<generator class="native" />
</id>
<property name="inRuteo" column="IN_RUTEO"/>
<property name="outRuteo" column="OUT_RUTEO"/>
<property name="procesado" column="PROCESADO"/>
<property name="tipoRegistro" column="TIPO_REG"/>
<property name="mercado" column="MERCADO"/>
<property name="idOrden" column="SEC_ORDEN"/>
<property name="rutCliente" column="RUT_CLI"/>
<property name="idRutCliente" column="SEC_RUT_CLI"/>
<property name="fechaIngresoOrden" column="FEC_ING_ORDEN"/>
<property name="fechaIngreso" column="FEC_ING"/>
<property name="fechaVencimiento" column="FEC_VCTO_VALIDEZ"/>
<property name="fechaVencimientoTP" column="FEC_VCTO_TP"/>
<property name="indiceValidez" column="IND_VALIDEZ"/>
<property name="indiceLiquidacion" column="IND_LIQUID"/>
<property name="producto" column="PRODUCTO"/>
<property name="origenOrden" column="ORIGEN_ORDEN"/>
<property name="nemo" column="NEMO"/>
<property name="cantidad" column="CANTIDAD"/>
<property name="precio" column="PRECIO"/>
<property name="tipoOperacion" column="TIPO_OPERAC"/>
<property name="status" column="STATUS"/>
</class>
</hibernate-mapping>[/code]

If you look at that with the exception throwed, the problem ocurred at the property "inRuteo".

But, that is my problem and i can not solve it.

My SQL is recovering some attributes, but hibernate report invalida column name of other attribute...

Need for your help.

Thanks.

Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 7:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes, you are telling the query to return ORWEBVO classes and as such you must return all the relevant columns for that mapping.

if you just want scalar values then use <return-scalar>

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Thu Mar 23, 2006 7:36 pm 
Regular
Regular

Joined: Wed Feb 22, 2006 11:28 am
Posts: 65
Location: Santiago, Chile
Thanks for your explanation, thats help me a lot.

Thanks.


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

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.