请问一个hibernate的.hbm.xml问题
在学习hibernate notebook的时候在第四章,遇到一个问题无法理解,向大家请教
问题如下:
artist.hbm.xml文件如下
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.oreilly.hh.Artist" table="ARTIST">
<meta attribute="class-description">
Represents an artist who is associated with a track or album.
@author Jim Elliott (with help from Hibernate)
</meta>
<id name="id" type="int" column="ARTIST_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="name" type="string">
<meta attribute="use-in-tostring">true</meta>
<column name="NAME" not-null="true" unique="true" index="ARTIST_NAME"/>
</property>
<set name="tracks" table="TRACK_ARTISTS" inverse="true">
<meta attribute="field-description">Tracks by this artist</meta>
<key column="ARTIST_ID"/>
<many-to-many class="com.oreilly.hh.Track" column="TRACK_ID"/>
</set>
</class>
<query name="com.oreilly.hh.artistByName">
<![CDATA[
from com.oreilly.hh.Artist as artist
where upper(artist.name) = upper(:name)
]]>
</query>
</hibernate-mapping>
在上面的这个xml文件中,请问
1 column 属性的含义是什么?在这里设立colume属性的目的是什么?
2 <set name="tracks" table="TRACK_ARTISTS" inverse="true">
<meta attribute="field-description">Tracks by this artist</meta>
<key column="ARTIST_ID"/>
<many-to-many class="com.oreilly.hh.Track" column="TRACK_ID"/>
</set>
在上面的这段xml代码中,请问什么时候用set关键字,这里key column是什么意思?inverse的目的是什么?请大家逐行解释以下这段xml代码片段,谢谢