how to lookup remapped values from a context
I'm stuck and in need of your help.
Assuming I have this context to work with the play framework:
package object mongoContext {
implicit val context = {
val context = new Context {
val name = "global"
override val typeHintStrategy = StringTypeHintStrategy(when = TypeHintFrequency.WhenNecessary, typeHint = "_t")
}
context.registerGlobalKeyOverride(remapThis = "id", toThisInstead = "_id")
context.registerClassLoader(Play.classloader)
context
}
}
How would one lookup dynamically what FieldName id is remapped to on the database side?
Thanks in advance
A field named "id" in your model object will be mapped to "_id" in the database.
As far as looking it up - ? in the Context - call
Context#determineFieldName(clazz: Class[_], fieldName: String)
链接地址: http://www.djcxy.com/p/65690.html
上一篇: Scala播放Salat聚合示例
下一篇: 如何从上下文中查找重新映射的值