Hi all!!
I need some help with a very simple question, which I can't find an answer.
I have two very simple classes:
##Class CSyncId
Code:
public class CSyncId {
private Long id;
public CSyncId(){
this.id = getNewSyncId();
}
}
## Class CSyncData
Code:
public class CSyncData {
private CSyncId syncId;
private Long tmstmp;
public CSyncData(String syncType){
this.syncId = new CSyncId();
tmstmp = 0L;
}
}
I have a table T_SYNC_DATA, which maps CSyncData class.
The table T_SYNC_DATA has two NUMBER columns, called SYNC_ID (PK)and TMSTMP!!
Now I need a mapping between the class CSyncData and the table, but I don't know how make the relation beetween the column SYNC_ID and the property syncId in CSyncData, which is, in fact, an object of CSyncId.
I tried something like:
Code:
<hibernate-mapping package="slva.sync.data">
<class name="CSyncData" table="T_SYNC_DATA">
<one-to-one name="syncId" class="CSyncId"/>
<property name="tmstmp" column="TMSTMP"/>
</class>
<class name="CSyncId">
<property name="id" ???/>
</class>
</hibernate-mapping>
I don't know how tell this mapping is a Primary Key, and how relation the 'id property of CSyncId (which id a Long)' with the column SYNC_ID.
Thanks a lot!!!!