Мне поручено обновить спящий режим приложения до hibernate 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, но я хочу понять, почему происходит ошибка.Я тоже не знаком с использованием сумок.Любая помощь в понимании ошибки будет принята.
Спасибо!