hibernate查询java.util.Map

时间:2014-03-11 07:51:53

标签: hibernate hql hibernate-criteria

我的DataRow班级有Map,其密钥的类型为PojoProperty,而值类型为PropertyData

我需要获得DataRowPojoProperty='(My PojoProperty Object)'的所有PropertyData.value like '%oct%'

我在Criteria&后来切换到HQL但找不到任何解决方案。 Plz Somebody Help。

这是我的代码: 1)          

<hibernate-mapping>
<class name="com.dashboard.persistence.truimport.DataRow" table="TI_DATAROW"        schema="core">
<id name="dataRowId" type="long">
<column name="DataRowId" />
<generator class="increment"/>
</id>

<many-to-one name="bunch" class="com.dashboard.persistence.truimport.Bunch" column="BunchId" /> 

<property name="lineNo" type="int" column="LineNo"/>
<property name="error" type="boolean" column="IsError"/>
<property name="warning" type="boolean" column="IsWarning"/>

<list name="prsMessageList" cascade="all-delete-orphan" lazy="false">
<key column="DataRowId"/>
<list-index column="rowIndex"/>
<one-to-many class="com.dashboard.persistence.truimport.PRSMessage"/>
</list>

<map name="dataMap" table="TI_DATAMAP" cascade="all-delete-orphan">
<key column="DataRowId"/>
<index-many-to-many class="com.dashboard.persistence.truimport.PojoProperty"   column="PojoPropertyId"/>
<many-to-many class="com.dashboard.persistence.truimport.PropertyData" column="PropertyDataId"/>
</map>
</class>
</hibernate-mapping>

2)

<?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="com.dashboard.persistence.truimport.PojoProperty" table="TI_PojoProperty" schema="core">
<id name="pojoPropertyId" type="long">
<column name="PojoPropertyId" />
<generator class="increment"/>
</id>
<many-to-one name="dataType" class="com.dashboard.persistence.truimport.DataType" column="DataTypeId"/>
<property name="name" type="string" column="Name"/>
 </class>
</hibernate-mapping>

3)

<?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="com.dashboard.persistence.truimport.PropertyData" table="TI_PropertyData"   schema="core">
<id name="propertyDataId" type="long">
<column name="PropertyDataId" />
<generator class="increment"/>
</id>
<property name="value" type="string" column="Value"/>
</class>
</hibernate-mapping>

0 个答案:

没有答案