|
Compiles just fine, but when I run-app it spits out this exception:
| Error 2012-08-05 22:53:33,033 [pool-6-thread-1] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Duplicate property mapping of _seShorefaceIndexBackref found in no.cipr.safari.model.depositional.outcrop.se.SeShoreface Message: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Duplicate property mapping of _seShorefaceIndexBackref found in no.cipr.safari.model.depositional.outcrop.se.SeShoreface Line | Method ->> 95 | postProcessBeanFactory in org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 303 | innerRun in java.util.concurrent.FutureTask$Sync | 138 | run . . . . . . . . . in java.util.concurrent.FutureTask | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . . . . . . . . in '' ^ 680 | run in java.lang.Thread Caused by MappingException: Duplicate property mapping of _seShorefaceIndexBackref found in no.cipr.safari.model.depositional.outcrop.se.SeShoreface ->> 95 | postProcessBeanFactory in org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 303 | innerRun in java.util.concurrent.FutureTask$Sync | 138 | run . . . . . . . . . in java.util.concurrent.FutureTask | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . . . . . . . . in '' ^ 680 | run in java.lang.Thread Process finished with exit code 1 The offending class (if I remove backlinks, other similar classes make the same error): package no.cipr.safari.model.depositional.outcrop.se import no.cipr.safari.model.depositional.outcrop.ae.AeLowerShorefaceDeposit import no.cipr.safari.model.depositional.outcrop.ae.AeRipChannel import no.cipr.safari.model.depositional.outcrop.ae.AeUpperShorefaceDeposit class SeShoreface { //Entity attributes OutcropSubEnvironment subEnvironment List<AeLowerShorefaceDeposit> aeLowerShorefaceDeposit List<AeRipChannel> aeRipChannel List<AeUpperShorefaceDeposit> aeUpperShorefaceDeposit static hasMany = [ aeLowerShorefaceDeposit: AeLowerShorefaceDeposit, aeRipChannel: AeRipChannel, aeUpperShorefaceDeposit: AeUpperShorefaceDeposit ] static belongsTo = [ filShoreface: FilShoreface, filTideInfluencedBarrierIsland: FilTideInfluencedBarrierIsland, filTideInfluencedShoreface: FilTideInfluencedShoreface, filWaveDominatedDelta: FilWaveDominatedDelta, filWaveDominatedEstuary: FilWaveDominatedEstuary, filWaveInfluencedTidalShoreline: FilWaveInfluencedTidalShoreline, filBarrierIsland: FilBarrierIsland ] static constraints = { aeLowerShorefaceDeposit(nullable: true) aeRipChannel(nullable: true) aeUpperShorefaceDeposit(nullable: true) //Multiple backlinks needs to be nullable filShoreface(nullable: true) filTideInfluencedBarrierIsland(nullable: true) filTideInfluencedShoreface(nullable: true) filWaveDominatedDelta(nullable: true) filWaveDominatedEstuary(nullable: true) filWaveInfluencedTidalShoreline(nullable: true) filBarrierIsland(nullable: true) } } I am pretty sure this is stemming from the general model structure being a tree with some interconnected branches, making some entities getting picked up twice but I have no idea how to solve it. Grails version 2.1.0.. -- ***** Oliver Tynes Developer Uni CIPR -- www.cipr.uni.no 55588266 ***** --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
This is the bug I think:
https://hibernate.onjira.com/browse/HHH-2598 And it says fixed for 3.2 and upwards... but grails doesn't use the hibernate version of this, it has rolled it's own in grails-hibernate. The offending code is here: https://github.com/grails/grails-core/blob/master/grails-hibernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L463 So.. if you have multiple domains pointing hasMany at a single domain, all using the same name *and* that domain being pointed at has belongsTo, you get a name collision. Now.. what do I do from here, do I JIRA it? The solution chosen in hibernate is very straightforward, simply add the parent name to the backref and you're done. I can patch in that and do a pull request maybe? If some of the core team guys sees this, please provide some feedback. -Oliver On Sun, Aug 5, 2012 at 11:20 PM, Oliver Severin Tynes <[hidden email]> wrote: > Compiles just fine, but when I run-app it spits out this exception: > > | Error 2012-08-05 22:53:33,033 [pool-6-thread-1] ERROR > context.GrailsContextLoader - Error executing bootstraps: Error > creating bean with name 'sessionFactory': Invocation of init method > failed; nested exception is org.hibernate.MappingException: Duplicate > property mapping of _seShorefaceIndexBackref found in > no.cipr.safari.model.depositional.outcrop.se.SeShoreface > Message: Error creating bean with name 'sessionFactory': Invocation of > init method failed; nested exception is > org.hibernate.MappingException: Duplicate property mapping of > _seShorefaceIndexBackref found in > no.cipr.safari.model.depositional.outcrop.se.SeShoreface > Line | Method > ->> 95 | postProcessBeanFactory in > org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > | 303 | innerRun in java.util.concurrent.FutureTask$Sync > | 138 | run . . . . . . . . . in java.util.concurrent.FutureTask > | 886 | runTask in > java.util.concurrent.ThreadPoolExecutor$Worker > | 908 | run . . . . . . . . . in '' > ^ 680 | run in java.lang.Thread > > Caused by MappingException: Duplicate property mapping of > _seShorefaceIndexBackref found in > no.cipr.safari.model.depositional.outcrop.se.SeShoreface > ->> 95 | postProcessBeanFactory in > org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > | 303 | innerRun in java.util.concurrent.FutureTask$Sync > | 138 | run . . . . . . . . . in java.util.concurrent.FutureTask > | 886 | runTask in > java.util.concurrent.ThreadPoolExecutor$Worker > | 908 | run . . . . . . . . . in '' > ^ 680 | run in java.lang.Thread > > Process finished with exit code 1 > > > > The offending class (if I remove backlinks, other similar classes make > the same error): > > package no.cipr.safari.model.depositional.outcrop.se > > import no.cipr.safari.model.depositional.outcrop.ae.AeLowerShorefaceDeposit > import no.cipr.safari.model.depositional.outcrop.ae.AeRipChannel > import no.cipr.safari.model.depositional.outcrop.ae.AeUpperShorefaceDeposit > > class SeShoreface { > > //Entity attributes > OutcropSubEnvironment subEnvironment > List<AeLowerShorefaceDeposit> aeLowerShorefaceDeposit > List<AeRipChannel> aeRipChannel > List<AeUpperShorefaceDeposit> aeUpperShorefaceDeposit > > static hasMany = [ > aeLowerShorefaceDeposit: AeLowerShorefaceDeposit, > aeRipChannel: AeRipChannel, > aeUpperShorefaceDeposit: AeUpperShorefaceDeposit > ] > > > static belongsTo = [ > filShoreface: FilShoreface, > filTideInfluencedBarrierIsland: FilTideInfluencedBarrierIsland, > filTideInfluencedShoreface: FilTideInfluencedShoreface, > filWaveDominatedDelta: FilWaveDominatedDelta, > filWaveDominatedEstuary: FilWaveDominatedEstuary, > filWaveInfluencedTidalShoreline: FilWaveInfluencedTidalShoreline, > filBarrierIsland: FilBarrierIsland > ] > > static constraints = { > aeLowerShorefaceDeposit(nullable: true) > aeRipChannel(nullable: true) > aeUpperShorefaceDeposit(nullable: true) > //Multiple backlinks needs to be nullable > filShoreface(nullable: true) > filTideInfluencedBarrierIsland(nullable: true) > filTideInfluencedShoreface(nullable: true) > filWaveDominatedDelta(nullable: true) > filWaveDominatedEstuary(nullable: true) > filWaveInfluencedTidalShoreline(nullable: true) > filBarrierIsland(nullable: true) > } > } > > I am pretty sure this is stemming from the general model structure > being a tree with some interconnected branches, making some entities > getting picked up twice but I have no idea how to solve it. > > Grails version 2.1.0.. > > -- > ***** > Oliver Tynes > Developer > Uni CIPR -- www.cipr.uni.no > 55588266 > ***** -- ***** Oliver Tynes Developer Uni CIPR -- www.cipr.uni.no 55588266 ***** --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
