Apache JDO Project - Issue 119: cannot add a constraint to a join table

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > June 2005 > Issue 119: cannot add a constraint to a join table





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Issue 119: cannot add a constraint to a join table
Craig Russell

2005-06-06, 7:49 am

Abe White

2005-06-06, 7:49 am

> There is no way to specify a constraint except on the columns mapped
> to fields in a class.


You can define constraints beneath the <class> element, and these
constraints can contain column elements for constraints on arbitrary
column sets. This is already described in the spec. If this doesn't
satisfy what you're looking for, then could you clarify exactly what
you think is lacking?


Craig Russell

2005-06-06, 7:49 am

Abe White

2005-06-06, 7:49 am

> Sorry, Abe, I should have reiterated the subject in the text. I'm
> talking about the fact that you cannot define constraints for join
> tables and tables used to contain Map and List fields. It's possible
> to define constraints on mapped columns of classes.


Sure you can. That's why the class-level constraint element have a
"table" attribute.


Craig Russell

2005-06-06, 7:49 am

2005-06-06, 7:49 am

It's supported under class elements, but IMO it's cleaner and straight
forward to set the constraints and whatever related inside the
associations <join>.

The declaration under class implies that we always have cardinality
greater than 1 for any element, like primary-key.

<class table="PERSON">
<primary-key table="PERSON">
....
</primary-key>
<primary-key table="PERSON_DEPT">
....
</primary-key>
....

It doesn't look good to me, and more, we can set primary-key or other
constraints for any table wherever we are.

<class table="APPLE">
<primary-key table="PERSON">
....
</primary-key>
<primary-key table="PERSON_DEPT">
....
</primary-key>
....

Erik Bengtson

-----Original Message-----
From: Craig Russell [mailto:Craig.Russell@Sun.COM]
Sent: Sunday, May 29, 2005 9:09 PM
To: Abe White
Cc: JDO Expert Group; jdo-dev@db.apache.org
Subject: Re: Issue 119: cannot add a constraint to a join table

Hi Abe,

Learn something every day.

So in order to define a primary key constraint on a join table, I'll
have to amend my primary-key proposal to include multiple column
elements and name= and table= attributes.

Thanks,

Craig

On May 29, 2005, at 11:56 AM, Abe White wrote:

>
> Sure you can. That's why the class-level constraint element have a
> "table" attribute.
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com