HI there,
What am I doing wrong?
I have a Message object and a Session object. Each message has one session. Each session may have one or more messages.
The two objects are not connected in the mapping, both have sessionId keys which can be used to join the two.
My only request: I would like to have a Session property in my Message POJO.
How do I map this out in a hiberante mapping HBM file?
This is what I tried so far - it returns a null for each Session:
Code:
<class name="GXMessageDisplayDBObject" table="Messages" lazy="false">
<id name="messageId">
<column name="MessageId" length="36"/>
</id>
<property name="SessionId" length="36" column="SESSION_ID"/>
[b]<one-to-one name="session" class="GXSessionDisplayDBObject" outer-join="auto"/> [/b]
<property name="Direction"/>
</class>
My Message POJO class has a getter/setter for my session object.
PS> I do not have a many-to-one relationship mapped in my Session XML file - is this necessary?
Thanks in advance
Eyal