These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: 3 tables related as composites
PostPosted: Wed Jan 06, 2010 3:59 am 
Newbie

Joined: Wed Jan 06, 2010 3:26 am
Posts: 2
Hi, i'm new with Hibernate and want to use a existing datamodel in Hibernate


Tabel: ST (ID = Primary Key)
--------
ID

Table: DD (ST_ID + NUMBER = Primary Key)
---------
ST_ID
NUMBER


Table: VALUE (ST_ID + DD_NUMBER + ROWNR = Primary Key)
---------
ST_ID
DD_NUMBER
ROWNR


Relation: ST one-many DD one-many VALUE

In my domain

Class StamTable
long id;
Set<DataDictionary> dds;

Class DataDictionary
long st_id;
long number;
Set<RowValue> rowvalues;

Class RowValue
int rownr
String value;


Now i want to map it with a set and composite like this

<class name="StamTable" table="ST" >
<id name="id"><generator class="sequence"/></id>
<set name="dds" table="DD">
<key column="ST_ID">
<composite-element class="DataDictionary">
<property name="number" not-null="true" />
</composite-element >
</class>

<class name="DataDictionary" table="DD">
<composite-id>
<key-property name="st_id" />
<key-property name="number" />
</composite-id>

<set name="rowvalues" table="VALUE">
<key>
<column name="ST_ID">
<column name="DD_NUMBER">
</key>

<composite-element class="RowValue">
<property name="rownr" not-null="true" />
</composite-element >
</class>

When i now make a StamTable, DataDictionary and RowValue object and save only the StamTable only a ST record and DD record get's inserted, not a VALUE record.

What can i do?

Regards,

Jeroen Wolff


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.