a.hbm.xml
<class name="com.xxx.bean.A"
table="A">
<id name="id"
column="id" not-null="true"
type="String">
<generate name="native"/>
</id>
<property
name="name"
column="table_name"
type="String"/>
</class>
b.hbm.xml
<class name="com.xxx.bean.B" table="B">
<id name="id"
column="id"
not-null="true" type="String">
<generate name="native"/>
</id>
<property
name="age"
column="age" type="String"/>
<many-to-one name="A"
column="a.id" type="String"/>
</class>
hibernate.cfg.xml
<resource mapping="com/xxx/bean/b.hbm.xml"/>
<resource mapping="com/xxx/beam/a.hbm.xml"/>
hql 语句
from
B a where a.id = 1