-->
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: I just know I am being stupid (composite-element question)
PostPosted: Wed Jun 16, 2004 7:17 am 
Newbie

Joined: Tue Apr 20, 2004 11:50 am
Posts: 4
If I have something like this :

<class name="User" table="USER">

<id name="id" column="USER_ID" unsaved-value="null">
<generator class="sequence">
<param name="sequence">SEQ_USER_ID</param>
</generator>
</id>

<property name="name" column="NAME"/>

<set name="usedPasswords" table="USED_PASSWORD">
<key column="USER_ID"/>
<composite-element class="UsedPassword">
<property name="password" column="PASSWORD"/>
<property name="lastUsedDate" column="LAST_USED_DATE"/>
</composite-element>
</list>
</class>

Where the USED_PASSWORD table is something like

create table CRS_USED_PASSWORD (
USER_ID NUMBER not null,
USED_PWD_ID NUMBER not null,
PASSWORD VARCHAR2(15) not null,
LAST_USED_DATE DATE not null,
constraint PK_CRS_USED_PASSWORD primary key (USER_ID, USED_PWD_ID)
);

Or even if USED_PWD_ID were a single PK and USER_ID just an FK..

How, when I do the following...

User user = from somewhere
UsedPassword up = new UsedPassword();
// set used password details
user.getUsedPasswords.add(up);

... does the value for USED_PWD_ID get generated before the used password entity is persisted to the database.

I have a feeling I have compeletely misunderstood something here.

Many thanks

Paul Branscombe


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.