开发者

Grails gorm-mongodb embedded objects

开发者 https://www.devze.com 2023-03-21 11:03 出处:网络
I have two mapped classes: BaseClass and ConcreteClass extends BaseClass, both are stored into same collections.

I have two mapped classes: BaseClass and ConcreteClass extends BaseClass, both are stored into same collections.

Base class have an field, stored as embedded value - object with class Dimensions, that i开发者_如何学运维s configured as embedded by:

class BaseClass {
    Dimensions dimensions

    static embedded = ['dimensions']
}

btw, when i'm trying to load it by BaseClass.get(id) it fails with NoSuchBeanDefinitionException: No bean named 'my.package.Dimensions' is defined

and, also, same problem when this class, with embedded field, becomes an embedded value inside an another object. I mean:

class OtherClass {
   BaseClass baseClass

   static embedded = ['baseClass']
}

How to configure those embedded objects/fields?

As MongoDB is a document-oriented storage, it's very commons situation to have deep objects structures for a stored document. But I can't figure out how it can be done with gorm-mongodb plugin

0

精彩评论

暂无评论...
验证码 换一张
取 消