Вопрос

In a schema-less how are made the relationship: embedded or referenced?

I can read in ODocument API that If I use the method

public ODocument field(String iFieldName,
          Object iPropertyValue,
          OType iFieldType)

to add a new field, I force the field type instead of to be auto-determined. I guess that by this function I can chose the type of relationship. But, if I don't use this method, which is the way to auto-determine the relationship type?

In this example:

ODocument doc = new ODocument("Person");
doc.field( "name", "Luke" );
doc.field( "surname", "Skywalker" );
doc.field( "city", new ODocument("City").field("name","Rome").field("country", "Italy"))

city is embedded or referenced? If it's embedded how can I make it referenced or vice versa?

Thanks! aGO!

Это было полезно?

Решение

Declare the property as embedded in the schema, or use the type on the fly while setting the property:

doc.field( "city", new ODocument("City").field("name","Rome").field("country", "Italy"),
                OType.EMBEDDED)

Embedded documents hasn't own RID.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top