-->
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: Same object returns from a view.
PostPosted: Thu Sep 11, 2008 10:35 am 
Newbie

Joined: Thu Apr 03, 2008 9:19 am
Posts: 4
Hibernate version: 3.2.5

Name and version of the database you are using: Oracle 10g
Hi,

I have a problem when I perform HQL requests against a view.

More precisely, when I perform a SQL request and then the equivalent HQL request, I find the same number of objects. But, in the case of the HQL request, all objets are the same one !

Here are the sample of my SQL and my HQL requests :


--- SQL Request ---
String query = "from MYVIEW as myview where myview .id = 18 and myview .anpNum = 19 and myview.ageRefagl = 20";

result = getSession().createQuery(query).list();

--- HQL Request ---
getSession().createSQLQuery("select * from MYVIEW where ID = 18 ANP_NUM = 19 and AGE_REFAGL = 20").list();

I hope that someone could help me.

Best regards

PS : Below, you can find my mapping hbm.xml file :

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 9 sept. 2008 17:11:44 by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="fr.projet.MYVIEW" table="MYVIEW">
<id name="id" type="java.lang.Long">
<column name="ID" precision="10" scale="0" />
<generator class="native"></generator>
</id>
<property name="cmcNom" type="string">
<column name="CMC_NOM" length="20" not-null="true" />
</property>
<property name="anpNum" type="long">
<column name="ANP_NUM" precision="10" scale="0" not-null="true" />
</property>
<property name="anfFreq" type="big_decimal">
<column name="ANF_FREQ" precision="8" />
</property>
<property name="sipNum" type="long">
<column name="SIP_NUM" precision="10" scale="0" not-null="true" />
</property>
<property name="sicNom" type="string">
<column name="SIC_NOM" length="50" not-null="true" />
</property>
<property name="aepNum" type="long">
<column name="AEP_NUM" precision="10" scale="0" not-null="true" />
</property>
<property name="ageRefagl" type="java.lang.Long">
<column name="AGE_REFAGL" precision="10" scale="0" />
</property>
<property name="valeur" type="string">
<column name="VALEUR" length="50" />
</property>
<property name="agpNum" type="long">
<column name="AGP_NUM" precision="10" scale="0" not-null="true" />
</property>
<property name="agcNom" type="string">
<column name="AGC_NOM" length="50" />
</property>
<property name="nbrValNiv" type="big_decimal">
<column name="NBR_VAL_NIV" precision="22" scale="0" />
</property>
<property name="nivMinAno" type="big_decimal">
<column name="NIV_MIN_ANO" precision="22" scale="0" />
</property>
<property name="nivMaxAno" type="big_decimal">
<column name="NIV_MAX_ANO" precision="22" scale="0" />
</property>
<property name="nivMoyAno" type="big_decimal">
<column name="NIV_MOY_ANO" precision="22" scale="0" />
</property>
<property name="nivEcaAno" type="big_decimal">
<column name="NIV_ECA_ANO" precision="22" scale="0" />
</property>
</class>
</hibernate-mapping>


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.