遇到一hibernate的bug,让人进退两,各位帮忙想想招

:cry:
hibernate 版本:hibernate-3.2.0.cr5
项目快结束了,遇到这个问题,郁闷啊,如果的确是bug,谁能帮返馈到hibernage,不胜感激(本人e文不太好)
映射文件1:

[code]<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class entity-name="QuData02" table="data_02">
<composite-id>
<key-property name="id" column="ID" type="string"/>
<key-property name="z0001" column="Z0001" type="string"/>
</composite-id>
<many-to-one name="idcode" entity-name="QuData01" column="ID" insert="false" update="false"/>
<!--注意 -->
<many-to-one name="z0002code" column="Z0002" not-found="ignore" entity-name="QuCodeRegion"/>

<many-to-one name="z0003code" column="Z0003" not-found="ignore" entity-name="QuCodeRegionDept"/>
<many-to-one name="z0004code" column="Z0004" not-found="ignore" lazy="false" entity-name="QuCodeItem1"/>
<property name="z0005" column="Z0005" type="string" not-null="false"/>
<property name="z0006" column="Z0006" type="string" not-null="false"/>
<many-to-one name="a0001code" column="A0001" not-found="ignore" lazy="false" entity-name="QuCodeItem1"/>
<many-to-one name="a0002code" column="A0002" not-found="ignore" lazy="false" entity-name="QuCodeItem2"/>
<many-to-one name="a0003code" column="A0003" not-found="ignore" lazy="false" entity-name="QuCodeItem3"/>
<property name="a0004" column="A0004" type="big_decimal" not-null="false"/>
<property name="a0005" column="A0005" type="string" not-null="false"/>
<many-to-one name="a0006code" column="A0006" not-found="ignore" lazy="false" entity-name="QuCodeSubject"/>
<many-to-one name="a0007code" column="A0007" not-found="ignore" lazy="false" entity-name="QuCodeItem1"/>
<property name="a0008" column="A0008" type="big_decimal" not-null="false"/>
<property name="a0009" column="A0009" type="string" not-null="false"/>
<property name="Flag" column="FLAG" type="string" not-null="false" length="10"/>
</class>
</hibernate-mapping>
[/code]
映射文件2:
[code]
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="cn.com.cfit.gztfjg.querystat.code.QuCodeItem1" table="CODE_REGION" entity-name="QuCodeRegion">
<id name="id" column="ID" type="string">
<generator class="assigned"/>
</id>
<property name="codesortid" column="CODESORTID" type="string" />
<!--注意 -->
<property name="codeid" column="CODEID1" type="string" />

<property name="codename" column="CODENAME" type="string"/>
<property name="codedetail" column="CODEDETAIL" type="string"/>
<property name="codelevel" column="CODELEVEL" type="int"/>
<property name="flag" column="FLAG" type="string"/>
</class>
</hibernate-mapping>
[/code]
查询使用的hql:
[code]
Select
C02.z0005,
C02.a0004,
C02.a0007code.codename,
C02.z0002code.codename,
C02.z0006
from QuData02 C02
Where (C02.z0002code.codeid like '41%' or C02.z0005 like '%王%') and C02.z0006 = '2006-01' order by C02.a0004 Desc
[/code]

输出的sql语句:
[code]
select
qudata02x0_.Z0005 as col_0_0_,
qudata02x0_.A0004 as col_1_0_,
qucodeitem2_.CODENAME as col_2_0_,
qucoderegi1_.CODENAME as col_3_0_,
qudata02x0_.Z0006 as col_4_0_
from
data_02 qudata02x0_,
CODE_REGION qucoderegi1_,
CODE_ITEM1 qucodeitem2_
where
qudata02x0_.A0007=qucodeitem2_.ID
and
(((qucoderegi1_.CODEID1 like '41%' and qudata02x0_.Z0002=qucoderegi1_.ID)or(qudata02x0_.Z0005 like '%王%' ))and(qudata02x0_.Z0006='2006-01' ))
order by qudata02x0_.A0004 Desc
[/code]
希望的输出结果:
[code]
select
qudata02x0_.Z0005 as col_0_0_,
qudata02x0_.A0004 as col_1_0_,
qucodeitem2_.CODENAME as col_2_0_,
qucoderegi1_.CODENAME as col_3_0_,
qudata02x0_.Z0006 as col_4_0_
from
data_02 qudata02x0_,
CODE_REGION qucoderegi1_,
CODE_ITEM1 qucodeitem2_
where
qudata02x0_.Z0002=qucoderegi1_.ID and
qudata02x0_.A0007=qucodeitem2_.ID
and
(((qucoderegi1_.CODEID1 like '41%')or(qudata02x0_.Z0005 like '%王%' ))and(qudata02x0_.Z0006='2006-01' ))
order by qudata02x0_.A0004 Desc
[/code]
注意输出结果中[color=red]qudata02x0_.Z0002=qucoderegi1_.ID[/color]的位置的不同.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值