このコンテンツは選択した言語では利用できません。
2.4.2. Mapping the Person Class
The first cut of the
Person
class looks like this:
Save this to a file named
src/main/java/org/hibernate/tutorial/domain/Person.java
Next, create the new mapping file as
src/main/resources/org/hibernate/tutorial/domain/Person.hbm.xml
Finally, add the new mapping to Hibernate's configuration immediately after the existing mapping for
Event.hbm.xml
:
<mapping resource="events/Event.hbm.xml"/> <mapping resource="events/Person.hbm.xml"/>
<mapping resource="events/Event.hbm.xml"/>
<mapping resource="events/Person.hbm.xml"/>
Create an association between these two entities. Persons can participate in events, and events have participants. The design questions you have to deal with are: directionality, multiplicity, and collection behavior.