Willem Veelenturf created DDLUTILS-277:
------------------------------------------

             Summary: Problem with clone table
                 Key: DDLUTILS-277
                 URL: https://issues.apache.org/jira/browse/DDLUTILS-277
             Project: DdlUtils
          Issue Type: Bug
            Reporter: Willem Veelenturf
            Assignee: Thomas Dudziak


When table is cloned the associated columns, indices, and foreignkeys are not 
clone correct. When you for example edit the the details of the column of the 
cloned table you also edit the details of the orginale table. The reason for 
this is that when an array list is cloned elements themselves are not copied.

Fix for this problem :

@Override
        public Object clone() throws CloneNotSupportedException {
                Table result = new Table();

                result.setSystemName(this.getSystemName());
                result.setCatalog(this.getCatalog());
                result.setSchema(this.getSchema());
                result.setName(this.getName());
                result.setType(this.getType());

                for (Column column : this.getColumns()) {
                        result.addColumn((Column) column.clone());
                }

                for (ForeignKey foreignKey : this.getForeignKeys()) {
                        result.addForeignKey((ForeignKey) foreignKey.clone());
                }

                for (Index index : this.getIndices()) {
                        result.addIndex((Index) index.clone());
                }

                return result;
        }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to