我的任务是将应用程序的休眠模式升级到休眠模式3,然后从定义的包中获取以下映射错误。
[1/20/19 16:08:23:315 CST] 000001bd SessionFactor E org.hibernate.impl.SessionFactoryImpl <init> Error in named query: Lookup.Type
org.hibernate.hql.ast.QuerySyntaxError: Lookup.values is not mapped. [
Select Lookup
from us.il.state.idpa.oigcase.model.LookupValueType Lookup, Lookup.values Values
where Lookup.systemConstantChr = :lookupType
and Lookup.id = Values.lookupValueTypeInt
and Values.activeB = true
]
这是2个表映射xmls
LookupValueType.hbm.xml
<class name="us.il.state.idpa.oigcase.model.LookupValueType" schema="OIG" table="LOOKUP_VALUE_TYPE">
<id column="LOOKUP_VALUE_TYPE_INT" name="id" type="long">
<generator class="native">
<param name="table">LOOKUP_VALUE_TYPE</param>
<param name="column">LOOKUP_VALUE_TYPE_INT</param>
</generator>
</id>
<timestamp column="SAT_UPDATE_TS" name="satUpdateTs" />
<bag name="values" table="LOOKUP_VALUE" schema="OIG"
cascade="all" order-by="SHORT_DESC_CHR"
inverse="true" >
<key column="LOOKUP_VALUE_TYPE_INT" />
<one-to-many class="us.il.state.idpa.oigcase.model.LookupValue" />
</bag>
<property column="DESC_CHR" length="40" name="descChr" not-null="true" type="string"/>
<property column="ACTIVE_B" length="1" name="activeB" not-null="true" type="string"/>
<property column="SYSTEM_CONSTANT_CHR" length="50" name="systemConstantChr" not-null="true" type="string"/>
<property column="SAT_CREATE_TS" length="26" name="satCreateTs" not-null="true" type="timestamp"/>
<property column="SAT_AGENT_ID" length="19" name="satAgentId" not-null="true" type="long"/>
<!-- <many-to-one column="SAT_AGENT_ID" name="agentName" class="us.il.state.idpa.oigcase.model.Name" insert="false" update="false" /> -->
</class>
<query name="Lookup.Type">
<![CDATA[Select Lookup
from LookupValueType Lookup, Lookup.values Values
where Lookup.systemConstantChr = :lookupType
and Lookup.id = Values.lookupValueTypeInt
and Values.activeB = true]]>
</query>
LookupValue.hbm.xml
<class name="us.il.state.idpa.oigcase.model.LookupValue" schema="OIG" table="LOOKUP_VALUE" >
<id column="LOOKUP_VALUE_INT" name="id" type="long">
<generator class="native">
<param name="table">LOOKUP_VALUE</param>
<param name="column">LOOKUP_VALUE_INT</param>
</generator>
</id>
<timestamp column="SAT_UPDATE_TS" name="satUpdateTs" />
<property column="LOOKUP_VALUE_TYPE_INT" length="5" name="lookupValueTypeInt" not-null="true" type="short"/>
<property column="SHORT_DESC_CHR" length="40" name="shortDescChr" not-null="true" type="string"/>
<property column="LONG_DESC_CHR" length="255" name="longDescChr" not-null="true" type="string"/>
<property column="ACTIVE_B" length="1" name="activeB" not-null="true" type="string"/>
<property column="SYSTEM_CONSTANT_CHR" length="50" name="systemConstantChr" not-null="true" type="string"/>
<property column="ADDITIONAL_INFO_CHR" length="255" name="additionalInfoChr" type="string"/>
<property column="SAT_CREATE_TS" length="26" name="satCreateTs" not-null="true" type="timestamp"/>
<property column="SAT_AGENT_ID" length="19" name="satAgentId" not-null="true" type="long"/>
<!-- <many-to-one name="owner" column="LOOKUP_VALUE_TYPE_INT" not-null="true" class="us.il.state.idpa.oigcase.model.LookupValueType" outer-join="true"/> -->
<!-- <many-to-one column="SAT_AGENT_ID" name="agentName" class="us.il.state.idpa.oigcase.model.Name" insert="false" update="false" /> -->
</class>
这是出现错误的查询:
Lookup.Type
<query name="Lookup.Type">
<![CDATA[Select Lookup
from LookupValueType Lookup, Lookup.values Values
where Lookup.systemConstantChr = :lookupType
and Lookup.id = Values.lookupValueTypeInt
and Values.activeB = true]]>
</query>
似乎我应该只重写Lookup.Type查询,但是我想了解为什么会发生错误。我也不熟悉使用袋子。在理解错误方面的任何帮助将不胜感激。
谢谢!