Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated MongoDomainASTTransformation.groovy to loop through ancestors…

… for id property
  • Loading branch information...
commit 8463c4929d1fac905113cd3adb323e8b7bbc1b75 1 parent c4a6987
@alexduan alexduan authored
View
29 .classpath
@@ -1,14 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/java"/>
- <classpathentry kind="src" path="src/groovy"/>
- <classpathentry kind="src" path="grails-app/conf"/>
- <classpathentry kind="src" path="grails-app/controllers"/>
- <classpathentry kind="src" path="grails-app/domain"/>
- <classpathentry kind="src" path="grails-app/services"/>
- <classpathentry kind="src" path="grails-app/taglib"/>
- <classpathentry kind="src" path="test/integration"/>
- <classpathentry kind="src" path="test/unit"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="web-app/WEB-INF/classes"/>
-</classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="src" path="src/groovy"/>
+ <classpathentry kind="src" path="grails-app/conf"/>
+ <classpathentry kind="src" path="test/integration"/>
+ <classpathentry kind="src" path="grails-app/mongo"/>
+ <classpathentry kind="src" path="grails-app/someotherdir"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/>
+ <classpathentry kind="src" path="tomcat-1.3.6-src-groovy">
+ <attributes>
+ <attribute name="com.springsource.sts.grails.core.SOURCE_FOLDER" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="web-app/WEB-INF/classes"/>
+</classpath>
View
15 .project
@@ -6,14 +6,27 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>com.springsource.sts.grails.core.nature</nature>
+ <nature>com.springsource.sts.grails.core.nature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
+ <linkedResources>
+ <link>
+ <name>tomcat-1.3.6-src-groovy</name>
+ <type>2</type>
+ <locationURI>GRAILS_ROOT/1.3.6/projects/gorm-mongodb/plugins/tomcat-1.3.6/src/groovy</locationURI>
+ </link>
+ </linkedResources>
</projectDescription>
View
2  grails-app/conf/DataSource.groovy
@@ -1,5 +1,5 @@
mongodb {
- replicaSet = [ "lbserver:27017"]
+ replicaSet = [ "localhost:27017"]
// host = 'lbserver'
// port = 27017
databaseName = 'gorm_test'
View
6 plugin.xml
@@ -1,8 +1,8 @@
-<plugin name='gorm-mongodb' version='0.5.2' grailsVersion='1.3.4 &gt; *'>
+<plugin name='mongodb-morphia' version='0.6.1' grailsVersion='1.3.4 &gt; *'>
<author>Juri Kuehn</author>
<authorEmail>juri.kuehn at gmail.com</authorEmail>
- <title>Grails MongoDB plugin</title>
- <description>GORM Layer for the superfast, highly scalable, schemafree, document oriented database MongoDB</description>
+ <title>Alternative MongoDB GORM based on the Morphia library (former gorm-mongodb)</title>
+ <description>GORM implementation for the MongoDB NoSQL database based on the Morphia library</description>
<documentation>http://wiki.github.com/jkuehn/gorm-mongodb/</documentation>
<resources>
<resource>BuildConfig</resource>
View
7 src/groovy/grails/plugins/mongodb/ast/MongoDomainASTTransformation.groovy
@@ -97,7 +97,12 @@ class MongoDomainASTTransformation implements ASTTransformation {
// if superclass has an id property, then skip injecting onto this one
ClassNode superClass = classNode.getSuperClass()
- if (superClass && superClass.fields.findAll({ it.getAnnotations(MORPHIA_ID) }).size() > 0) return
+
+ //loop through superclasses to make sure no ancestors have the id property
+ while (superClass) {
+ if(superClass.fields.findAll({ it.getAnnotations(MORPHIA_ID) }).size() > 0) return
+ superClass = superClass.getSuperClass()
+ }
// annotate node id if present, otherwise inject id property
PropertyNode identity = getProperty(classNode, IDENTITY)
Please sign in to comment.
Something went wrong with that request. Please try again.