db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Edwin Santosa <kata...@telkom.net>
Subject RE: autoincrement of non primary key
Date Thu, 04 Mar 2004 06:15:08 GMT
Hi,
On Kam, 2004-03-04 at 12:49, Dave Newton wrote:
> On Wed, 2004-03-03 at 23:55, Jeff Cox wrote:
> > Unless I am missing something, <unique> only makes the individual field
> > unique. What I need is the combination to be unique. In other words... 
> > 
> > If 
> > SESSION_ID = 10
> > SECTION_ID = 15
> > ACTIVITY_ID = 25
> > 
> > then 10, 15, and 25 can't be again used together.. but
> > 
> > SESSION_ID = 10
> > SECTION_ID = 15
> > ACTIVITY_ID = 30
> > 
> > Would work because even though SESSION_ID and SECTION_ID have been 10
> > and 15 before, they have not been in combination with 30.
> 
> Oh, I see what you mean now. Still don't understand why, though ;)
> 
> In any case, you'd need to write your own logic to handle this case, as
> it isn't really that common.
How about:
<unique name="foo">
    <unique-column name="SESSION_ID"/>
    <unique-column name="SECTION_ID"/>
    <unique-column name="ACTIVITY_ID"/>
</unique>
> 
> It seems like perhaps you might want to break up the tables a bit, maybe
> rethink the mapping a bit. IOW, it looks like you have a think called a
> session, a section, and an activity. Rather than mapping them all in one
> table, have an activity table that has an activity_id (unique, primary
> key) and session and section ids that point into the session and section
> tables.
> 
> Without knowing what you're actually trying to accomplish it's tough ;)
> 
> Dave
Regards,
Thomas Edwin Santosa


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message