The approach question.getQuestionId().getSearch() will work fine. There is other approach as well.
Code:
<class name="Question">
<composite-id>
<key-property name="Search" column="SearchID"/>
<key-property name="Number" column="questionNumber"/>
</composite-id>
<many-to-one name="searchObject" column="SearchID" insert="false" update="false" class="Search"/>
<set name="Answers">
<key column="AnswerID"/>
<one-to-many class="Answer"/>
</set>
</class>
In this case I will have a simple class QuestionPK with two properties( Search, Number ) and have your mapping class Question extend QuestionPK. Hibernate just needs to know your mapping class information i.e. Question and doesnt need to know anything about QuestionPK. Make sure to have QuestionPK implement Serializable interface.
question.getSearch()
question.getSearchObject()
first one gives you only ID information.
second one gives you reference to object.
Check this link also
http://www.hibernate.org/117.html#A34