Good morning to everyone
I have this problem: I have to read rows from a table with no primary key (I can not modify the database!). I have the mapping files with big composite key. I try to retrieve data with usual code (i have other tens of table with pk and fk and it is everything ok), the iterator correctly have the right number of rows, but when i cast the result to my java class i get always NULL.
If i use Native Query everything works fine, but i'd like to use hib query.
Thanks
Lorenzo Avoledo
Hibernate version:
3.3.1 but also 3.2.6
Mapping documents:
<?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 27-giu-2008 11.57.59 by Hibernate Tools 3.2.0.CR1 -->
<hibernate-mapping>
<class name="Ictbwbut" table="ICTBWBUT">
<composite-id name="id"
class="it.scpnet.hib.sipal.IctbwbutId">
<key-property name="userName" type="string">
<column name="USER_NAME" length="20" />
</key-property>
<key-property name="anagcod" type="big_decimal">
<column name="ANAGCOD" precision="38" scale="0" />
</key-property>
<key-property name="tipoUiterr" type="string">
<column name="TIPO_UITERR" length="1" />
</key-property>
<key-property name="codice" type="big_decimal">
<column name="CODICE" precision="38" scale="0" />
</key-property>
<key-property name="impostadovuta" type="big_decimal">
<column name="IMPOSTADOVUTA" precision="15" />
</key-property>
<key-property name="impacconto" type="big_decimal">
<column name="IMPACCONTO" precision="15" />
</key-property>
<key-property name="impsaldo" type="big_decimal">
<column name="IMPSALDO" precision="15" />
</key-property>
<key-property name="valore" type="big_decimal">
<column name="VALORE" precision="15" />
</key-property>
<key-property name="zncensdich" type="string">
<column name="ZNCENSDICH" length="3" />
</key-property>
<key-property name="categuidich" type="string">
<column name="CATEGUIDICH" length="3" />
</key-property>
<key-property name="classeuidich" type="string">
<column name="CLASSEUIDICH" length="2" />
</key-property>
<key-property name="descAliq" type="string">
<column name="DESC_ALIQ" length="120" />
</key-property>
<key-property name="percAliq" type="big_decimal">
<column name="PERC_ALIQ" precision="5" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
iter = ses.createQuery("from Ictbwbut").list().iterator();
while (iter.hasNext()) {
wbut = (Ictbwbut) iter.next();
}
Full stack trace of any exception that occurs:
NO exception occurs
Name and version of the database you are using:
Oracle XE
The generated SQL (show_sql=true):
select
ictbwbut0_.USER_NAME as USER1_120_,
ictbwbut0_.ANAGCOD as ANAGCOD120_,
ictbwbut0_.TIPO_UITERR as TIPO3_120_,
ictbwbut0_.CODICE as CODICE120_,
ictbwbut0_.IMPOSTADOVUTA as IMPOSTAD5_120_,
ictbwbut0_.IMPACCONTO as IMPACCONTO120_,
ictbwbut0_.IMPSALDO as IMPSALDO120_,
ictbwbut0_.VALORE as VALORE120_,
ictbwbut0_.ZNCENSDICH as ZNCENSDICH120_,
ictbwbut0_.CATEGUIDICH as CATEGUI10_120_,
ictbwbut0_.CLASSEUIDICH as CLASSEU11_120_,
ictbwbut0_.DESC_ALIQ as DESC12_120_,
ictbwbut0_.PERC_ALIQ as PERC13_120_
from
ICTBWBUT ictbwbut0_
Debug level Hibernate log excerpt:
--
The variable wbut is always NULL for each iteration!!!
|