db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata/torque TorqueForeignKeyGenerator.java
Date Wed, 02 Apr 2003 08:23:45 GMT
arminw      2003/04/02 00:23:44

  Modified:    src/java/org/apache/ojb/broker/metadata/torque
                        TorqueForeignKeyGenerator.java
  Log:
  skip foreign key, MtoM generation for
  abstract base classes and interfaces
  
  Revision  Changes    Path
  1.6       +16 -5     db-ojb/src/java/org/apache/ojb/broker/metadata/torque/TorqueForeignKeyGenerator.java
  
  Index: TorqueForeignKeyGenerator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/torque/TorqueForeignKeyGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TorqueForeignKeyGenerator.java	2 Apr 2003 07:40:50 -0000	1.5
  +++ TorqueForeignKeyGenerator.java	2 Apr 2003 08:23:44 -0000	1.6
  @@ -131,9 +131,16 @@
           }
       }
   
  -    private void buildManyToManyReferences(ClassDescriptor cd, CollectionDescriptor collectionDescriptor,
Object keys[], Vector columns) {
  +    private void buildManyToManyReferences(ClassDescriptor cd, CollectionDescriptor collectionDescriptor,
  +                                           Object keys[], Vector columns)
  +    {
  +        if(cd.isAbstract() || cd.isInterface())
  +        {
  +            System.out.println("Skip foreign key build for MtoM, found abstract base class
or interface " +
  +                                cd.getClassNameOfObject());
  +            return;
  +        }
           StringBuffer buffer = new StringBuffer(256);
  -
           buildForeignKeyHeader(cd.getFullTableName(), buffer);
   
           for (int i = 0; i < keys.length; i++) {
  @@ -170,8 +177,14 @@
       }
   
       private void buildForeignKey(ClassDescriptor foreignClassDescriptor, Vector foreignKeyIndices,
ClassDescriptor classDescriptor) {
  -        StringBuffer buffer = new StringBuffer(256);
   
  +        if(classDescriptor.isAbstract() || classDescriptor.isInterface())
  +        {
  +            System.out.println("Skip foreign key build, found abstract base class or interface
" +
  +                                classDescriptor.getClassNameOfObject());
  +            return;
  +        }
  +        StringBuffer buffer = new StringBuffer(256);
           buildForeignKeyHeader(foreignClassDescriptor.getFullTableName(), buffer);
   
           for (int i = 0; i < foreignKeyIndices.size(); i++) {
  @@ -185,8 +198,6 @@
               }
               else
               {
  -//                    System.out.println("## object: "+obj+" cld is interface: "+classDescriptor.isInterface()+
  -//                                            " cld is abstract "+classDescriptor.isAbstract());
                       FieldDescriptor fld = classDescriptor.getFieldDescriptorByName((String)
obj);
                       if(fld == null)
                       {
  
  
  

Mime
View raw message