db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Veelenturf (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DDLUTILS-277) Problem with clone table
Date Fri, 15 Jun 2012 13:43:42 GMT
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

        

Mime
View raw message