openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar" <ppod...@bea.com>
Subject RE: svn commit: r492225 - in /incubator/openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/meta/ openjpa-persisten
Date Tue, 09 Jan 2007 02:56:40 GMT
 Hello Michael,
  > is there any reason why we can't move the code into a more common
location?
  None. I will move it to SchemaGenerator.

  Thanks --


Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: Michael Dick [mailto:michael.d.dick@gmail.com] 
Sent: Thursday, January 04, 2007 11:38 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: svn commit: r492225 - in /incubator/openjpa/trunk:
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/
openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/meta/
openjpa-persisten

I'm a little unclear on why the code is in ClassMapping, too. It seems
like it could go in the SchemaGenerator along with
generatePrimaryKeys(), generateIndexes(), etc.

Pinaki, is there any reason why we can't move the code into a more
common location?

On 1/3/07, Abe White <awhite@bea.com> wrote:
>
> I don't agree with this implementation.  It doesn't leave any room for

> customization through MappingDefaults, it ties the ClassMapping to the

> XMLSchemaParser (?!), and it's totally different than our mapping of 
> indexes, foreign keys, and primary keys, the other supported 
> constraint types.
>
> > +        mapUniqueConstraints();
> > +    }
> > +
> > +    /**
> > +     * Adds unique constraints to the mapped table.
> > +     *
> > +     */
> > +    void mapUniqueConstraints() {
> > +        Log log = getRepository().getLog();
> > +        Collection uniqueInfos = _info.getUniqueConstraints();
> > +        if (uniqueInfos == null || uniqueInfos.isEmpty())
> > +            return;
> > +        Iterator iter = uniqueInfos.iterator();
> > +        Table table = getTable();
> > +        int i = 1;
> > +        while (iter.hasNext()) {
> > +            XMLSchemaParser.UniqueInfo uniqueInfo =
> > +                (XMLSchemaParser.UniqueInfo)iter.next();
> > +            if (uniqueInfo.cols == null ||
uniqueInfo.cols.isEmpty())
> > +                continue;
> > +            String constraintName = table.getName() + "_UNIQUE_" +
i;
> > +            i++;
> > +            Unique uniqueConstraint = table.addUnique
> > (constraintName);
> > +            Iterator uniqueColumnNames =
uniqueInfo.cols.iterator();
> > +            while (uniqueColumnNames.hasNext()) {
> > +                String uniqueColumnName = (String)
> > uniqueColumnNames.next();
> > +                Column uniqueColumn = table.getColumn
> > (uniqueColumnName);
> > +                if (uniqueColumn != null) {
> > +                    uniqueConstraint.addColumn(uniqueColumn);
> > +                } else {
> > +                    table.removeUnique(uniqueConstraint);
> > +                    if (log.isWarnEnabled())
> > +                        log.warn(_loc.get("missing-unique-column",
> > this,
> > +                            table.getName(), uniqueColumnName));
> > +                    break;
> > +                }
> >              }
> >          }
> >      }
> ______________________________________________________________________
> _
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>



--
-Michael Dick
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Mime
View raw message