Closed alexduan closed 13 years ago
This issue should be closed with release 0.6.1 and 0.6.2
Hello, I am seeing this issue in my app, and I am using version 0.7.3.
I think it might have something to do with the plugin automatically inserting an ObjectId id field if you don't manually specify an id field. As a result, the parent object gets an automatic ObjectId id and the same happens for the child class, and this results in the duplicates. But I'm not sure.
To give you a full picture of what I am doing: I have 6-7 classes created in /mongo via create-mongodb-class. One of these is the base class MongoObject, which contains many fields that are common to all other classes. 4-5 other classes extend MongoObject. There is another class called ParentClassA which extends MongoObject, and which further has two children of its own, ClassB and ClassC.
If I try to run my grails app with this setup, I get complaints like:
Attempted workaround: If I move the class MongoObject into a different folder (src/groovy) as indicated in one of the above comments, and leave out the @Entity annotation, then the above errors go away.
BUT: I'm not sure if this works yet, since I am unable to get the @AlsoLoad annotation working in this (or any) configuration. It's probably unrelated to this issue, but until the app is fully working I can't be sure that this is a valid workaround (I've reported this separate issue on the morphia mailing list: http://groups.google.com/group/morphia/browse_thread/thread/b74cca98a021db1a# )
Thanks.
Environment: Grails 1.3.6, mongodb-morphia-0.6
I have an abstract class, BaseDomain:
Which is extended by Person:
When starting up my Grails app, I get the following error:
This error only occurs if the superclass also resides within the grails-app/mongo source folder (I tried moving the abstract class out just to check). Unfortunately, that is not a feasible solution for all my classes since I have another class extending Person, and I get the same error.