Frage

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

War es hilfreich?

Lösung

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)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top