0
我想映射集合(類型映射)。休眠IndexColumn與地圖
Below are the tables
Product:
PID - primary key
NAME
ProductProperties:
ID - primary key auto_increment
PID - FK references Product(ID)(INDEXED)
KEY - (INDEXED)
VALUE
及以下用於映射
<?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.test.Product" table="product" catalog="cart">
<id name="pid" type="long">
<column name="pid" />
<generator class="assigned" />
</id>
<property name="name" type="string">
<column name="name" length="100" not-null="true" />
</property>
<map name="properties" table="properties" cascade="all">
<key column="pid" not-null="true"/>
<map-key column="key" type="string"/>
<element column="value" type="string"/>
</map>
</class>
</hibernate-mapping>
在許多例子中的HBM文件,我看不是。
我對此有幾個問題。
- 爲什麼使用IndexColumn而不是map-key?
- 哪個更好? IndexColumn或map-key
- 我在哪裏可以找到詳細的文檔來了解IndexColumn和map-key?
請提前幫助並提前致謝。
謝謝你這麼灰 – user1075205