Hy,
got the following situation:
Two Database-Tables:
1. loc_entry_history:
- "ehid": primary key, auto_increment, unique
- "time": Timestamp
- "views": int
2. loc_entry_history_info:
- "ehid": foreign key on "loc_entry_history.ehid", primary key, unique
- "title": String
- "plz": String
As you can see, this results in a 1:1 mapping between loc_entry_history and loc_entry_history_info. I managed to get the Data into to classes ("History" and "Info") by the following config:
Code:
<class name="de.dbruhn.framework.test.beans.History" table="loc_entry_history">
<id name="id" column="ehid">
<generator class="native" />
</id>
<property name="time" column="ehtime" type="timestamp" />
<property name="ip" column="ehip" />
<property name="views" column="ehviews" />
</class>
<class name="de.dbruhn.framework.test.beans.Info" table="loc_entry_info">
<id name="id" column="ehid">
<generator class="foreign">
<param name="property">history</param>
</generator>
</id>
<one-to-one name="history" constrained="true"/>
<property name="title" column="eititle" />
<property name="plz" column="eiplz" />
</class>
but this is not what I want:
I want the Data to be stored in a single Class, so one Class with the Name "history" where also the "title" and "plz" are stored.
How can I do this? I tried changing the "class name="[...].Info" into "class name="[...].History" but then the property "history" is missing. But I cant add the property history to the class, it would be a self-reference.
Thanks for any help
TO