cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-2016) cdbimport: Rename table with toMany relationship causes migration error
Date Mon, 05 Dec 2016 14:19:58 GMT

    [ 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 <stariy95@gmail.com>
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)

Mime
View raw message