34

I am using Criteria with projections to get a list of tags on my Account domain. Like this:

def tags = Account.createCriteria().list { 
    projections { property("tags") } 
}

My Account domain:

class Account {
    static mapWith = "mongo"
    List<Tag> tags
    ...
    static embedded = ['tags']
}

BuildConfig.groovy

// using grails 2.3.8
plugins {
    runtime ":hibernate:3.6.10.17"
    compile ":mongodb:2.0.1"

This worked until I upgraded the MongoDB GORM plugin for grails from 2.0.1 to 3.0.1

    compile ":mongodb:3.0.1"

Now I see the following error...

The class [java.util.List] is not a known persistent type.
    at org.grails.datastore.mapping.core.AbstractSession.retrieveAll(AbstractSession.java:723)
    at org.grails.datastore.mapping.mongo.query.MongoQuery$AggregatedResultList.initializeFully(MongoQuery.java:1601)
    at org.grails.datastore.mapping.mongo.query.MongoQuery$AggregatedResultList.size(MongoQuery.java:1764)

Why did this work before but is failing now? I don't want to rewrite all my existing queries to use mongoDB's aggregation framework.

Haleystorm
  • 374
  • 2
  • 4
  • Did you ever find a fix or run this through a debugger to see what has changed in the method calls from 2.0.1 to 3.0.1? – th3morg Oct 23 '14 at 16:20
  • This is a bit of an old question, but have you tried removing the Hibernate runtime? I know there is a conflict with Mongo and Hibernate. – kevingreen Mar 16 '15 at 15:20
  • Hello, Trying to clen up unanswered. Did you solve this? Maybe you can answer your own question. – Neoryder Oct 23 '15 at 12:38

2 Answers2

1

You can try the usual

grails clean
grails refresh-dependencies

Also check for a newer version of your plugin.

Another alternative is switch to this mongo plugin published a month ago, which is supposed to be compatible with GORM for Hibernate

'org.grails.plugins:mongodb:6.0.0.M2'
Joe Jadamec
  • 156
  • 1
  • 8
-1

You can avoid the conflict by removing hibernate from your plug-in manager

Matt
  • 74,352
  • 26
  • 153
  • 180
akhil verma
  • 390
  • 1
  • 3
  • 15