Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 14B7B200BCF for ; Mon, 5 Dec 2016 15:20:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1350E160B17; Mon, 5 Dec 2016 14:20:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5CAAD160AF9 for ; Mon, 5 Dec 2016 15:19:59 +0100 (CET) Received: (qmail 90610 invoked by uid 500); 5 Dec 2016 14:19:58 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 90458 invoked by uid 99); 5 Dec 2016 14:19:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Dec 2016 14:19:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 628382C14F3 for ; Mon, 5 Dec 2016 14:19:58 +0000 (UTC) Date: Mon, 5 Dec 2016 14:19:58 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: commits@cayenne.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAY-2016) cdbimport: Rename table with toMany relationship causes migration error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 05 Dec 2016 14:20:00 -0000 [ https://issues.apache.org/jira/browse/CAY-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15722381#comment-15722381 ] ASF GitHub Bot commented on CAY-2016: ------------------------------------- GitHub user stariy95 opened a pull request: https://github.com/apache/cayenne/pull/151 CAY-2016 cdbimport: Rename table with toMany relationship causes migration error Real problem here is sorting order of MergeTokens. In this fix: - Improved sort on DbImportAction - Added sorting to DB migration Whole sorting need to be review and possibly rewritten. You can merge this pull request into a Git repository by running: $ git pull https://github.com/stariy95/cayenne CAY-2016 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cayenne/pull/151.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #151 ---- commit 0c20dca5173f8aa069fe7dbca193a9016065ddd5 Author: Nikita Timofeev Date: 2016-12-05T14:18:13Z CAY-2016 cdbimport: Rename table with toMany relationship causes migration error Real problem here is sort order of MergeTokens. - Improved sort on DbImportAction - Added sorting to DB migration Whole sorting need to be review and possibly rewritten. ---- > cdbimport: Rename table with toMany relationship causes migration error > ------------------------------------------------------------------------ > > Key: CAY-2016 > URL: https://issues.apache.org/jira/browse/CAY-2016 > Project: Cayenne > Issue Type: Bug > Affects Versions: 4.0.M3 > Reporter: Denis Koyro > Assignee: Nikita Timofeev > > Tested on Cayenne 4.0.M3.3f0c7f9 > Let's consider the example with "artist" and "painting" tables. > "artist" table was renamed as "artist2" > Here are cdbimport logs: > [INFO] Detected changes: > [INFO] Add Relationship artist2 painting->artist2.id > [INFO] Create Table artist2 > [INFO] Drop db-relationship artist painting->artist.id > [INFO] Drop db-relationship paintings artist->painting.artist_id > [INFO] Drop Table artist > [ERROR] Migration Error. Can't apply changes from token: Add Relationship (artist2 painting->artist2.id) > java.lang.IllegalArgumentException: An attempt to override relationship 'artist2' > at org.apache.cayenne.map.Entity.addRelationship(Entity.java:193) > at org.apache.cayenne.merge.AddRelationshipToModel.execute(AddRelationshipToModel.java:43) > at org.apache.cayenne.tools.dbimport.DbImportAction.execute(DbImportAction.java:218) > at org.apache.cayenne.tools.dbimport.DbImportAction.execute(DbImportAction.java:118) > at org.apache.cayenne.tools.DbImporterMojo.execute(DbImporterMojo.java:256) > at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) > at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) > at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) > at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) > at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) > at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) > at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) > at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) > at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) > at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) > at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) -- This message was sent by Atlassian JIRA (v6.3.4#6332)