Hi,

With the code snippet:


private static void test() {
    OPartitionedDatabasePool databasePool = 
        new OPartitionedDatabasePool("memory:sandbox", "admin", "admin");

    /* create 3 Person docs */
    try (ODatabaseDocumentTx db = databasePool.acquire()) {
        db.begin();
        ODocument luke = new ODocument("Person")
            .field("name", "Luke").field("friends", new HashSet<ODocument
>());
        ODocument friend1 = new ODocument("Person")
            .field("name", "friend1").field("friends", new HashSet<ODocument
>());
        ODocument friend2 = new ODocument("Person")
            .field("name", "friend2").field("friends", new HashSet<ODocument
>());
    
        luke.save();
        friend1.save();
        friend2.save();

        db.commit();
    }

    /* add 2 friends to Luke */
    try (ODatabaseDocumentTx db = databasePool.acquire()) {
        db.begin();


        OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>(
            "select from Person where name = ?");


        ODocument luke = ((List<ODocument>) db.command(query).execute("Luke"
)).get(0);
        ODocument friend1 = ((List<ODocument>) db.command(query).execute(
"friend1")).get(0);
        ODocument friend2 = ((List<ODocument>) db.command(query).execute(
"friend2")).get(0);

        Set<ODocument> friendsLink = luke.field("friends", OType.LINKSET);
        friendsLink.add(friend1);
        friendsLink.add(friend2);

        luke.save();
        db.commit();
    }

    /* check type of objects returns in the "friends" mv link */
    try (ODatabaseDocumentTx db = databasePool.acquire()) {
        OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>(
            "select from Person where name = ?");

        ODocument luke = ((List<ODocument>) db.command(query).execute("Luke"
)).get(0);

        Object friends = luke.field("friends", OType.LINKSET);


        for (Object friend : (Collection<?>)friends) {
            System.out.println(" " + friend.getClass().getSimpleName());   
<--- prints "ORecordId" in 2.0 RC1, prints ODocument in 1.7.9
        }
    }
}

In 1.7.9, multi-valued link field returns a collection of 
ODocument(expected), but in 2.0 RC1 it returns a collection of ORecordId.

Is this a bug in 2.0 RC1 or am I missing something?

I am using memory storage.
 
Thanks!

fei



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to